Skip to content

Commit c18973b

Browse files
committed
Make documentation easier to find in ExDoc
1 parent 0ee2313 commit c18973b

3 files changed

Lines changed: 32 additions & 29 deletions

File tree

lib/ex_doc.ex

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,6 @@
11
defmodule ExDoc do
22
@moduledoc """
3-
Main entry point for generating docs.
4-
"""
5-
@ex_doc_version Mix.Project.config()[:version]
6-
7-
@doc """
8-
Returns the ExDoc version (used in templates).
9-
"""
10-
@spec version :: String.t()
11-
def version, do: @ex_doc_version
12-
13-
@doc """
14-
Emits a warning.
15-
"""
16-
def warn(message, stacktrace_info) do
17-
:persistent_term.put({__MODULE__, :warned?}, true)
18-
IO.warn(message, stacktrace_info)
19-
end
20-
21-
defp unset_warned() do
22-
warned? = :persistent_term.get({__MODULE__, :warned?}, false)
23-
:persistent_term.erase({__MODULE__, :warned?})
24-
warned?
25-
end
26-
27-
@doc ~S"""
28-
Generates documentation for the given `project`, `vsn` (version),
29-
`source_beams` directories, and `options`.
3+
ExDoc is a tool to generate documentation for Erlang and Elixir projects.
304
315
By default it generates HTML, Markdown, and EPUB documents.
326
@@ -512,6 +486,35 @@ defmodule ExDoc do
512486
all documented versions and their URLs. ExDoc will automatically match
513487
the version of the package with the one in the array to mark as current.
514488
"""
489+
@ex_doc_version Mix.Project.config()[:version]
490+
491+
@doc """
492+
Returns the ExDoc version (used in templates).
493+
"""
494+
@spec version :: String.t()
495+
def version, do: @ex_doc_version
496+
497+
@doc """
498+
Emits a warning.
499+
"""
500+
def warn(message, stacktrace_info) do
501+
:persistent_term.put({__MODULE__, :warned?}, true)
502+
IO.warn(message, stacktrace_info)
503+
end
504+
505+
defp unset_warned() do
506+
warned? = :persistent_term.get({__MODULE__, :warned?}, false)
507+
:persistent_term.erase({__MODULE__, :warned?})
508+
warned?
509+
end
510+
511+
@doc ~S"""
512+
Generates documentation for the given `project`, `vsn` (version),
513+
`source_beams` directories, and `options`.
514+
515+
This is the entrypoint called `mix docs` and other tools. See
516+
the moduledoc (`ExDoc`) for more information.
517+
"""
515518
@spec generate(String.t(), String.t(), [Path.t()], Keyword.t()) ::
516519
[%{entrypoint: String.t(), warned?: boolean(), formatter: module()}]
517520
def generate(project, version, source_beams, options)

lib/ex_doc/cli.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ defmodule ExDoc.CLI do
228228
The file must either have ".exs" or ".config" extension.
229229
230230
The file with the ".exs" extension must be an Elixir script that returns
231-
a keyword list with the same options declares in `ExDoc.generate/4`.
231+
a keyword list with the same options specified in `ExDoc`.
232232
Here is an example:
233233
234234
[

lib/mix/tasks/docs.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ defmodule Mix.Tasks.Docs do
6262
be set. The following options should be put under the `:docs` key
6363
in your project's main configuration. The `:docs` options should
6464
be a keyword list or a function returning a keyword list that will
65-
be lazily executed. See all supported options in `ExDoc.generate/4`.
65+
be lazily executed. See all supported options in `ExDoc`.
6666
6767
## Umbrella project
6868

0 commit comments

Comments
 (0)