Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions lib/ex_doc/cli.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ defmodule ExDoc.CLI do
{opts, args, _invalid} =
OptionParser.parse(args,
aliases: [
a: :assets,
n: :canonical,
c: :config,
o: :output,
f: :formatter,
i: :filter_prefix,
r: :source_root,
u: :source_url,
m: :main,
p: :homepage_url,
e: :extra,
s: :extra_section,
a: :assets,
i: :filter_prefix,
f: :formatter,
p: :homepage_url,
l: :logo,
n: :canonical,
m: :main,
o: :output,
r: :source_root,
u: :source_url,
v: :version,
],

Expand Down Expand Up @@ -118,25 +118,25 @@ defmodule ExDoc.CLI do
PROJECT Project name
VERSION Version number
BEAMS Path to compiled beam files
-a, --assets Path to a directory that will be copied as is to the "assets"
directory in the output path
-n, --canonical Indicate the preferred URL with rel="canonical" link element
-c, --config Give configuration through a file instead of command line
-o, --output Path to output docs, default: "doc"
-f, --formatter Docs formatter to use (html or epub), default: "html"
-i, --filter-prefix Include only modules that match the given prefix in
the generated documentation.
-r, --source-root Path to the source code root, default: "."
-u, --source-url URL to the source code
--source-ref Branch/commit/tag used for source link inference, default: "master"
-m, --main The entry-point page in docs, default: "api-reference"
-p, --homepage-url URL to link to for the site name
-e, --extra Allow users to include additional Markdown files
May be given multiple times
-s, --extra-section Allow user to define the title for the additional Markdown files,
default: "PAGES"
-a, --assets Path to a directory that will be copied as is to the "assets"
directory in the output path
-i, --filter-prefix Include only modules that match the given prefix in
the generated documentation.
-f, --formatter Docs formatter to use (html or epub), default: "html"
-p, --homepage-url URL to link to for the site name
-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
-n, --canonical Indicate the preferred URL with rel="canonical" link element
-m, --main The entry-point page in docs, default: "api-reference"
--source-ref Branch/commit/tag used for source link inference, default: "master"
-r, --source-root Path to the source code root, default: "."
-u, --source-url URL to the source code
-o, --output Path to output docs, default: "doc"
-v, --version Print ExDoc version

## Source linking
Expand Down
76 changes: 39 additions & 37 deletions lib/mix/tasks/docs.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ defmodule Mix.Tasks.Docs do

## Command line options

* `--output`, `-o` - Output directory for the generated
docs, default: `"doc"`
* `--formatter`, `-f` - Which formatters to use, "html" or
"epub", default: "html" (may be given more than once)
* `--canonical`, `-n` - Indicate the preferred URL with
rel="canonical" link element, defaults to no canonical path

* `--formatter`, `-f` - Which formatters to use, "html" or
"epub", default: "html" (may be given more than once)

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

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

Expand Down Expand Up @@ -45,53 +47,53 @@ defmodule Mix.Tasks.Docs do
be a keyword list or a function returning a keyword list that will
be lazily executed.

* `:output` - Output directory for the generated docs; default: "doc".
May be overridden by command line argument.

* `:formatters` - Formatter to use; default: ["html"],
options: "html", "epub".
* `:assets` - Path to a directory that will be copied as is to the "assets"
directory in the output path. Its entries may be referenced in your docs
under "assets/ASSET.EXTENSION"; defaults to no assets directory.

* `:source_root` - Path to the source code root directory;
default: "." (current directory).
* `:canonical` - String that defines the preferred URL with the rel="canonical"
element; defaults to no canonical path.

* `:source_beam` - Path to the beam directory; default: mix's compile path.
* `:deps` - A keyword list application names and their documentation URL.
ExDoc will by default include all dependencies and assume they are hosted on
HexDocs. This can be overridden by your own values. Example: `[plug: "https://myserver/plug/"]`

* `:source_ref` - The branch/commit/tag used for source link inference;
default: "master".
* `:extra_section` - String that defines the section title of the additional
Markdown pages; default: "PAGES". Example: "GUIDES"

* `:source_url_pattern` - Public URL of the project. Derived from
project's `:source_url` and `:source_ref`. Example:
"https://github.com/USER/APP/blob/master/%{path}#L%{line}"
* `:extras` - List of keywords, each key must indicate the path to additional
Markdown pages, the value for each keyword (optional) gives you more control
about the PATH and the title of the output files; default: `[]`. Example:
`["README.md", "CONTRIBUTING.md": [filename: "contributing", title: "Contributing", group: "Join us!"]]`

* `:main` - Main page of the documentation. It may be a module or a
generated page, like "Plug" or "api-reference"; default: "api-reference".
* `:filter_prefix` - Include only modules that match the given prefix in
the generated documentation. Example: "MyApp.Core"

* `:assets` - Path to a directory that will be copied as is to the "assets"
directory in the output path. Its entries may be referenced in your docs
under "assets/ASSET.EXTENSION"; defaults to no assets directory.
* `:formatters` - Formatter to use; default: ["html"],
options: "html", "epub".

* `:logo` - Path to the image logo of the project (only PNG or JPEG accepted)
The image size will be 64x64. When specified, the logo will be placed under
the "assets" directory in the output path under the name "logo" and the
appropriate extension.

* `:extras` - List of keywords, each key must indicate the path to additional
Markdown pages, the value for each keyword (optional) gives you more control
about the PATH and the title of the output files; default: `[]`. Example:
`["README.md", "CONTRIBUTING.md": [filename: "contributing", title: "Contributing", group: "Join us!"]]`
* `:main` - Main page of the documentation. It may be a module or a
generated page, like "Plug" or "api-reference"; default: "api-reference".

* `:extra_section` - String that defines the section title of the additional
Markdown pages; default: "PAGES". Example: "GUIDES"
* `:source_beam` - Path to the beam directory; default: mix's compile path.

* `:deps` - A keyword list application names and their documentation URL.
ExDoc will by default include all dependencies and assume they are hosted on
HexDocs. This can be overridden by your own values. Example: `[plug: "https://myserver/plug/"]`
* `:source_ref` - The branch/commit/tag used for source link inference;
default: "master".

* `:canonical` - String that defines the preferred URL with the rel="canonical"
element; defaults to no canonical path.
* `:source_root` - Path to the source code root directory;
default: "." (current directory).

* `:filter_prefix` - Include only modules that match the given prefix in
the generated documentation. Example: "MyApp.Core"
* `:source_url_pattern` - Public URL of the project. Derived from
project's `:source_url` and `:source_ref`. Example:
"https://github.com/USER/APP/blob/master/%{path}#L%{line}"

* `:output` - Output directory for the generated docs; default: "doc".
May be overridden by command line argument.

## Umbrella project

Expand All @@ -109,8 +111,8 @@ defmodule Mix.Tasks.Docs do
Mix.Task.run "compile"

{cli_opts, args, _} = OptionParser.parse(args,
aliases: [o: :output, n: :canonical, f: :formatter],
switches: [output: :string, canonical: :string, formatter: :keep])
aliases: [n: :canonical, f: :formatter, o: :output],
switches: [canonical: :string, formatter: :keep, output: :string])

if args != [] do
Mix.raise "Extraneous arguments on the command line"
Expand Down