Like Codox for LFE. Check out the self-generated documentation.
First, make sure you have the lfe-compile plugin as a dependency in your
project's rebar.config
or, better yet, in the the global rebar3 config, ~/.config/rebar3/rebar.config
:
{plugins,
[{'lfe-compile', ".*",
{git, "git://github.com/lfe-rebar3/compile.git",
{tag, "0.2.0"}}}]}
Then in your project's rebar.config
, include the provider pre-hook:
{provider_hooks,
[{pre, [{compile, {lfe, compile}}]}]}
Finally, add Lodox to your plugins
list:
{plugins,
[% ...
{lodox, ".*",
{git, "git://github.com/quasiquoting/lodox.git",
{tag, "0.12.1"}}}]}.
The recommended place for the Lodox plugin entry is the global rebar3 config, ~/.config/rebar3/rebar.config
,
but it works at the project level, too.
In order for Lodox to work, your project must first be compiled:
rebar3 compile
Then, to invoke Lodox, simply run:
rebar3 lfe lodox
Alternatively, you can do
both at once:
rebar3 do compile, lfe lodox
If all goes well, the output will look something like:
Generated lodox v0.12.1 docs in /path/to/lodox/doc
And, as promised, generated documentation will be in the doc
subdirectory of
your project.
Optionally, you can add Lodox as a compile
post-hook:
{provider_hooks,
[{pre, [{compile, {lfe, compile}}]},
{post, [{compile, {lfe, lodox}]}]}.
[ Modified from Codox documentation. ]
If you have the source available at a URI and would like to have links to the
function/macro's source file in the documentation, you can set the 'source-uri'
configuration parameter in your application resource file.
{env,
[{'source-uri',
"https://github.com/foo/bar/blob/{version}/{filepath}#L{line}"}]}
The URI is a template that may contain the following keys:
Key | Description |
---|---|
filepath | the file path from the root of the repository |
line | the line number of the source file |
version | the version of the project |
N.B. In order for {version}
to work properly, you must add the corresponding
tag. For example, if your .app
file contains {vsn, "1.2.3"}
you must add the
tag, "1.2.3"
, to your repo.
[ Modified from Codox documentation. ]
By default, docstrings are rendered by Lodox as Markdown via pandoc. If pandoc
is not available, Lodox will fall back to erlmarkdown.
It is strongly recommended that you install pandoc, as it is much more robust.
In a future version, you will be able to override this behaviour by specifying an explicit format for your docstrings.
Markdown docstrings also support wikilink-style relative links, for referencing other definitions. Definitions in the current module will be matched first, and then Lodox will try to find a best match out of all the definitions it's documenting.
N.B. Module-less definitions in .lfe
files in the include
directory,
e.g. lodox-macros, will also be included in the search.
(defun bar (x)
"See [[foo/2]] and [[baz:square/1]] for other examples."
...)
Lodox is licensed under the MIT License.
The MIT License (MIT)
Copyright © 2015-2016 Eric Bailey <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Significant code and inspiration from Codox. Copyright © 2015 James Revees
Codox is distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.