table of contents
EX_DOC(1) | ExDoc for Debian GNU/Linux | EX_DOC(1) |
NAME¶
ex_doc - generate Elixir/Erlang documentation from sources
SYNOPSIS¶
ex_doc PROJECT VERSION BEAMS [OPTIONS]
DESCRIPTION¶
ExDoc is a tool to generate documentation for Erlang and Elixir projects. To see an example, [you can access Elixir's official docs](https://hexdocs.pm/elixir/).
FEATURES¶
ExDoc ships with many features:
* Automatically generates online- and offline-accessible HTML and EPUB
documents from your API documentation.
* Responsive design, covering phones and tablets.
* Support for custom pages, guides, livebooks and cheatsheets.
* Support for custom grouping of modules, functions, and pages in the
sidebar.
* Customizable logo.
* A direct link back to the source code for every documented entity.
* Full-text search.
* Keyboard shortcuts. (Press `?` to show help.)
* Quick-search with autocompletion support. (`s` keyboard shortcut.)
* Go-to shortcut with auto-complete to take the reader to any HexDocs package
documentation. (`g` keyboard shortcut.)
* Support for night mode, activated according to the browser preference.
* Tooltips for links to modules and functions, both for the current project
and other projects.
* Version dropdown, automatically configured when hosted on HexDocs.
OPTIONS¶
- PROJECT
- Project name.
- VERSION
- Version number.
- BEAMS
- Path to compiled beam files.
- --canonical
- Indicate the preferred URL with rel="canonical" link element.
- -c, --config
- Give configuration through a file instead of a command line. See "Custom config" section below for more information.
- -f, --formatter
- Docs formatter to use (html or epub), default: html and epub.
- --homepage-url
- URL to link to for the site name.
- --language
- Identify the primary language of the documents, its value must be a valid [BCP 47](https://tools.ietf.org/html/bcp47) language tag, default: "en".
- -l, --logo
- Path to the image logo of the project (only PNG or JPEG accepted) The image size will be 64x64 and copied to the assets directory.
- -m, --main
- The entry-point page in docs, default: "api-reference".
- -o, --output
- Path to output docs, default: "doc".
- --package
- Hex package name.
- --paths
- Prepends the given path to Erlang code path. The path might contain a glob pattern but in that case, remember to quote it: --paths "_build/dev/lib/*/ebin". This option can be given multiple times.
- --proglang
- The project's programming language, default: "elixir".
- -q, --quiet
- Only output warnings and errors.
- --source-ref
- Branch/commit/tag used for source link inference, default: "master".
- -u, --source-url
- URL to the source code.
- -v, --version
- Print ExDoc version.
EXAMPLES¶
ex_doc "Ecto" "0.8.0" "_build/dev/lib/ecto/ebin" -u "https://github.com/elixir-ecto/ecto"
ex_doc "Project" "1.0.0" "_build/dev/lib/project/ebin" -c "docs.exs"
CUSTOM CONFIG¶
A custom config can be given with the `--config` option.
The file must either have ".exs" or ".config" extension.
The file with the ".exs" extension must be an Elixir script that returns a keyword list with the same options declares in `Mix.Tasks.Docs`. Here is an example:
[
extras: Path.wildcard("lib/elixir/pages/*.md"),
groups_for_docs: [
Guards: & &1[:guard] == true
],
skip_undefined_reference_warnings_on:
["compatibility-and-deprecations"],
groups_for_modules: [
...
]
]
The file with the ".config" extension must contain Erlang terms separated by ".". See `:file.consult/1` for more information. Here is an example:
{extras, [<<"README.md">>,
<<"CHANGELOG.md">>]}.
{main, <<"readme">>}.
{proglang, erlang}.
SOURCE LINKING¶
ExDoc by default provides links to the source code implementation as long as `--source-url` or `--source-url-pattern` is provided. If you provide `--source-url`, ExDoc will inflect the url pattern automatically for GitHub, GitLab, and Bitbucket URLs. For example:
--source-url "https://github.com/elixir-ecto/ecto"
Will be inflected as:
https://github.com/elixir-ecto/ecto/blob/master/%{path}#L%{line}
To specify a particular branch or commit, use the `--source-ref` option:
--source-url "https://github.com/elixir-ecto/ecto" --source-ref
"v1.0"
will result in the following URL pattern:
https://github.com/elixir-ecto/ecto/blob/v1.0/%{path}#L%{line}
AUTHORS¶
Plataformatec & The Elixir Team.
2024-03-02 | 0.31.1+dfsg-1 |