mix docs (ExDoc v0.40.1)

Copy Markdown View Source

Uses ExDoc to generate a static web page from the project documentation.

Command line options

  • --canonical, -n - Indicate the preferred URL with rel="canonical" link element, defaults to no canonical path

  • --formatter, -f - Which formatters to use, html, epub, or markdown. This option can be given more than once. By default, html, epub, and markdown are generated.

  • --language - Specifies the language to annotate the EPUB output in valid BCP 47

  • --open - open browser window pointed to the documentation

  • --output, -o - Output directory for the generated docs, default: "doc"

  • --proglang - Chooses the main programming language: elixir or erlang

  • --warnings-as-errors - Exits with non-zero exit code if any warnings are found

The command line options have higher precedence than the options specified in your mix.exs file below.

Configuration

ExDoc will automatically pull in information from your project, like the application and version. However, you may want to set :name, :source_url and :homepage_url to have a nicer output from ExDoc, for example:

def project do
  [
    app: :my_app,
    version: "0.1.0-dev",
    deps: deps(),

    # Docs
    name: "My App",
    source_url: "https://github.com/USER/PROJECT",
    homepage_url: "http://YOUR_PROJECT_HOMEPAGE",
    docs: [
      main: "MyApp", # The main page in the docs
      favicon: "path/to/favicon.png",
      logo: "path/to/logo.png",
      extras: ["README.md"]
    ]
  ]
end

ExDoc also allows configuration specific to the documentation to be set. The following options should be put under the :docs key in your project's main configuration. The :docs options should be a keyword list or a function returning a keyword list that will be lazily executed. See all supported options in ExDoc.generate/4.

Umbrella project

ExDoc can be used in an umbrella project and generates a single documentation for all child apps. You can use the :ignore_apps configuration to exclude certain projects in the umbrella from documentation.

Generating documentation per each child app can be achieved by running:

mix cmd mix docs

See mix help cmd for more information.