Giter VIP home page Giter VIP logo

ex_doc's Introduction

ExDoc

Build Status

ExDoc is a tool to generate documentation for Erlang and Elixir projects. To see an example, you can access Elixir's official docs.

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.

Usage

You can use ExDoc with Mix (recommended for Elixir projects), with Rebar (recommended for Erlang projects), or via the command line.

Mix

ExDoc requires Elixir v1.12 or later. Then add ExDoc as a dependency:

def deps do
  [
    {:ex_doc, "~> 0.31", only: :dev, runtime: false},
  ]
end

Then run mix deps.get.

Erlang development environment {: .warning}

Some Operating System distributions split Erlang into multiple packages, and at least one ExDoc dependency (earmark_parser) requires the Erlang development environment. If you see a message like "/usr/lib/erlang/lib/parsetools-2.3.1/include/yeccpre.hrl: no such file or directory", it means you lack this environment. For instance, on the Debian operating system and its derivatives, you need to apt install erlang-dev.

ExDoc will automatically pull in information from your projects, such as the application and version. However, you may want to set :name, :source_url and :homepage_url in order to have nicer output from ExDoc:

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

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

Now you are ready to generate your project documentation with mix docs. To see all options available, run mix help docs.

To learn about how to document your projects, see Elixir's writing documentation page.

Rebar3

From Erlang/OTP 24+, you can use ExDoc to render your Erlang documentation written with EDoc. See rebar3_ex_doc for more information.

CLI

You can use ExDoc via the command line.

  1. Install ExDoc as an escript:

    $ mix escript.install hex ex_doc
  2. Now you are ready to use it in your projects. Move into your project directory and make sure it's compiled:

    $ cd PATH_TO_YOUR_PROJECT
    $ mix compile
  3. Invoke the ex_doc executable from your project:

    $ ex_doc "PROJECT_NAME" "PROJECT_VERSION" _build/dev/lib/project/ebin -m "PROJECT_MODULE" -u "https://github.com/GITHUB_USER/GITHUB_REPO" -l path/to/logo.png

    Examples of appropriate values:

    PROJECT_NAME    => Ecto
    PROJECT_VERSION => 0.1.0
    PROJECT_MODULE  => Ecto (the main module provided by the library)
    GITHUB_USER     => elixir-lang
    GITHUB_REPO     => ecto
    

You can specify a config file via the --config option, both Elixir and Erlang formats are supported. Invoke ex_doc without arguments to learn more.

Syntax highlighting

ExDoc uses the makeup project for syntax highlighting. By default, highlighters for Erlang and Elixir are included. To syntax-highlight other languages, simply add the equivalent makeup_LANGUAGE package to your mix.exs/rebar.config file. For example, for HTML support you would add:

Elixir (Mix)

{:makeup_html, ">= 0.0.0", only: :dev, runtime: false}

Erlang (Rebar3)

{makeup_html, "0.1.1"}

You can find all supported languages under the Makeup organization on GitHub and view them at Makeup's website.

Additional pages

You can publish additional pages in your project documentation by configuring them as :extras. The following formats and extensions are supported:

  • Markdown (.md extension) - useful for general long-term text. Learn more.

  • Cheatsheets (.cheatmd extension) - useful for discovery and quick reference. Learn more.

  • Livebooks (.livemd extension) - useful for tutorials, interactive examples, and deep dives. Learn more.

For example, you can set your :extras to:

Elixir

extras: ["README.md", "LICENSE", "tutorial.livemd", "cheatsheet.cheatmd"]

Run mix help docs for more information on configuration.

Erlang

{extras, [<<"README.md">>, <<"cheatsheet.cheatmd">>]}.

Metadata

ExDoc supports metadata keys in your documentation.

Elixir

In Elixir, you can add metadata to modules and functions.

For a module, use @moduledoc, which is equivalent to adding the annotation to everything inside the module (functions, macros, callbacks, types):

@moduledoc since: "1.10.0"

For a function, use @doc:

@doc since: "1.13.1"

Erlang

In Erlang's EDoc:

%% @since 0.1.0

The following metadata is available for both modules and functions:

  • deprecated (binary) - marks a module/function as deprecated, with the given string as the reason.
  • since (binary) - declares a module/function available from a particular version.

The following metadata is available for modules:

  • tags (list of atoms) - a list of strings to be added as tags to the module. (Not supported by EDoc.)

Auto-linking

ExDoc for Elixir and Erlang will automatically generate links across modules and functions if you enclose them in backticks.

Elixir

ExDoc will automatically link modules, functions, types or callbacks defined in your project and its dependencies (including Erlang and Elixir). ExDoc will automatically link to it at the dependency's documentation at hexdocs.pm. The link can be configured by setting docs: [deps: [my_dep: "https://path/to/docs/"]] in your mix.exs.

ExDoc supports linking to modules (`MyModule` and `m:MyModule`), functions (`MyModule.function/1`), types (`t:MyModule.type/2`) and callbacks (`c:MyModule.callback/3`). If you want to link a function, type or callback in the current module, you may skip the module name, for example: `function/1`.

You can also use custom text, such as [custom text](`MyModule.function/1`). Link to extra pages using the syntax [Up and running](Up and running.md). The final link will be automatically converted to up-and-running.html.

Link to extra pages in another application using the syntax [Writing Documentation](`e:elixir:writing-documentation.html`), skipping the directory in which the page is. The final link will be automatically converted to https://hexdocs.pm/elixir/writing-documentation.html.

It is also possible to place anchors after the module name and extra pages. For example:

  • `m:Keyword#module-duplicate-keys-and-ordering` will create a link to https://hexdocs.pm/elixir/Keyword.html#module-duplicate-keys-and-ordering

  • `e:elixir:syntax-reference.md#expressions` will create a link to https://hexdocs.pm/elixir/syntax-reference.html#expressions

Erlang

ExDoc will automatically link modules, functions, types or callbacks defined in your project and its dependencies (including Erlang and Elixir). ExDoc will automatically link to it at the dependency's documentation at hexdocs.pm. The link can be configured by setting docs: [deps: [my_dep: "https://path/to/docs/"]] in your mix.exs. The link can be configured by setting {docs, [{deps, [{my_dep, "https://path/to/docs/"}]}]} in your rebar3.config.

ExDoc supports linking to modules (`m:my_module`), functions (`my_module:function/1`), types (`t:my_module:type/2`) and callbacks (`c:my_module:callback/3`). If you want to link a function, type or callback in the current module, you may skip the module name; e.g.: `function/1`.

You can also use custom text, such as [custom text](`my_module:function/1`). This also allows you to refer to Erlang/OTP modules: [The array module](`array`) (note that when a module is given as the link target, it is not necessary nor possible to use the m: prefix).

Link to extra pages using the syntax [Up and running](Up and running.md). The final link will be automatically converted to up-and-running.html.

Link to extra pages in another application using the syntax [Using unicode](`e:stdlib:unicode_usage.html`), skipping the directory in which the page is. The final link will be automatically converted to https://hexdocs.pm/elixir/writing-documentation.html.

It is also possible to place anchors after the module name and extra pages. For example:

  • `m:argparse#quick-start` will create a link to https://erlang.org/doc/man/argparse#quick-start

  • `e:stdlib:unicode-usage.md#what-unicode-is` will create a link to https://erlang.org/doc/apps/stdlib/unicode-usage.html#what-unicode-is

Admonition blocks

You may want to draw attention to certain statements by taking them out of the content's flow and labeling them with a priority. Such statements are called admonitions. (They are also known as asides or callouts.) An admonition block is rendered based on the assigned label or class. ExDoc supports warning, error, info, tip and neutral tags, on header levels h3 and h4.

The syntax is as follows:

> #### Error {: .error}
>
> This syntax will render an error block

The result for the previous syntax is:

Error {: .error}

This syntax will render an error block

For example, if you change the class name to neutral, you get the same admonition block in neutral style:

Neutral {: .neutral}

This syntax will render a neutral block

Tabsets

Where only one section of content of a series is likely to apply to the reader, you may wish to define a set of tabs.

This example contains code blocks, separating them into tabs based on language:

Elixir

IO.puts "Hello, world!"

Erlang

io:fwrite("Hello, world!\n").

Tabbed content must be defined between <!-- tabs-open --> and <!-- tabs-close --> HTML comments. Each h3 heading results in a new tab panel, with its text setting the tab button label.

Here is the above example's source:

<!-- tabs-open -->

### Elixir

```elixir
IO.puts "Hello, world!"
```

### Erlang

```erlang
io:fwrite("Hello, world!\n").
```

<!-- tabs-close -->

Extensions

ExDoc renders Markdown content for you, but you can extend it to render complex objects on the page using JavaScript. To inject custom JavaScript into every page, add this to your configuration:

docs: [
  # ...
  before_closing_head_tag: &before_closing_head_tag/1,
  before_closing_body_tag: &before_closing_body_tag/1
]

# ...

defp before_closing_head_tag(:html) do
  """
  <!-- HTML injected at the end of the <head> element -->
  """
end

defp before_closing_head_tag(:epub), do: ""

defp before_closing_body_tag(:html) do
  """
  <!-- HTML injected at the end of the <body> element -->
  """
end

defp before_closing_body_tag(:epub), do: ""

Besides an anonymous function, you can also pass a module-function-args tuple. It will call the given module and function, with the format prefixed to the arguments:

docs: [
  # ...
  before_closing_head_tag: {MyModule, :before_closing_head_tag, []},
  before_closing_body_tag: {MyModule, :before_closing_body_tag, []}
]

Or you can pass a map where the key is the format:

docs: [
  # ...
  before_closing_head_tag: %{html: "...", epub: "..."},
  before_closing_body_tag: %{html: "...", epub: "..."}
]

Rendering Math

If you write TeX-style math in your Markdown, such as $\sum_{i}^{N} x_i$, it ends up as raw text on the generated pages. To render expressions, we recommend using KaTeX, a JavaScript library that turns expressions into graphics. To load and trigger KaTeX on every documentation page, we can insert the following HTML:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-vKruj+a13U8yHIkAyGgK1J3ArTLzrFGBbBc0tDp4ad/EyewESeXE/Iv67Aj8gKZ0" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha384-PwRUT/YqbnEjkZO0zZxNqcxACrXe+j766U2amXcgMg5457rve2Y7I6ZJSm2A0mS4" crossorigin="anonymous"></script>

<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex-copytex.min.css" rel="stylesheet" type="text/css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex-copytex.min.js" crossorigin="anonymous"></script>

<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin="anonymous"
  onload="renderMathInElement(document.body, {
    delimiters: [
      {left: '$$', right: '$$', display: true},
      {left: '$', right: '$', display: false},
    ]
  });"></script>
</script>

For more details and configuration options, see the KaTeX Auto-render Extension.

Rendering Vega-Lite plots

Snippets are also objects you may want to render in a special manner. For example, assuming your Markdown includes Vega-Lite specification in vega-lite code snippets:

<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script>
  document.addEventListener("DOMContentLoaded", function () {
    for (const codeEl of document.querySelectorAll("pre code.vega-lite")) {
      try {
        const preEl = codeEl.parentElement;
        const spec = JSON.parse(codeEl.textContent);
        const plotEl = document.createElement("div");
        preEl.insertAdjacentElement("afterend", plotEl);
        vegaEmbed(plotEl, spec);
        preEl.remove();
      } catch (error) {
        console.log("Failed to render Vega-Lite plot: " + error)
      }
    }
  });
</script>

For more details and configuration options, see vega/vega-embed.

Rendering Mermaid graphs

Similarly to the example above, if your Markdown includes Mermaid graph specification in mermaid code snippets:

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.min.js"></script>
<script>
  document.addEventListener("DOMContentLoaded", function () {
    mermaid.initialize({
      startOnLoad: false,
      theme: document.body.className.includes("dark") ? "dark" : "default"
    });
    let id = 0;
    for (const codeEl of document.querySelectorAll("pre code.mermaid")) {
      const preEl = codeEl.parentElement;
      const graphDefinition = codeEl.textContent;
      const graphEl = document.createElement("div");
      const graphId = "mermaid-graph-" + id++;
      mermaid.render(graphId, graphDefinition).then(({svg, bindFunctions}) => {
        graphEl.innerHTML = svg;
        bindFunctions?.(graphEl);
        preEl.insertAdjacentElement("afterend", graphEl);
        preEl.remove();
      });
    }
  });
</script>

For more details and configuration options, see the Mermaid usage docs.

Contributing

The easiest way to test changes to ExDoc is to locally rebuild the app and its own documentation:

  1. Run mix setup to install all dependencies
  2. Run mix build to generate the docs and open up the generated doc/index.html
  3. (optional) Run npm run --prefix assets build:watch if working on assets for automatic recompilation
  4. Run mix lint to check linting and formatting (and mix fix to automatically fix it)
  5. (important) Do not add the files in the formatters/ directory to your commits, those will be handled by the maintainers

See the README in the assets/ directory for more information on working on the assets.

License

ExDoc source code is released under the Apache 2 License. The generated contents, however, are under different licenses based on projects used to help render HTML, including CSS, JS, and other assets.

Any documentation generated by ExDoc, or any documentation generated by any "Derivative Works" (as specified in the Apache 2 License), must include a direct, readable, and visible link to the ExDoc repository on each rendered material. For HTML pages, every single page is a rendered material. For PDF, EPUB and other ebook formats, the whole body of documentation is a rendered material.

ex_doc's People

Contributors

alco avatar allyraza avatar angelikatyborska avatar archdragon avatar cristineguadelupe avatar cw789 avatar cybrox avatar davidoliver avatar dependabot[bot] avatar dignifiedquire avatar eksperimental avatar ericmj avatar garazdawi avatar jonatanklosko avatar josevalim avatar jwarwick avatar lexmag avatar milmazz avatar nscyclone avatar paulo-valim avatar pdilyard avatar rafaelfranca avatar robertdober avatar simonprev avatar timothyvanderaerden avatar tmbb avatar viniciusmuller avatar whatyouhide avatar wojtekmach avatar zachallaun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ex_doc's Issues

Autolinking

We should inspect the documentation source and provide autolinking. For example, if we mention a function as function/2, we should automatically add a documentation link for it. The same for external functions as External.function/2.

mix docs error

Hello,

Tried to build docs with mix docs but getting error:

** (UndefinedFunctionError) undefined function: :supervisor.__info__/1
    :supervisor.__info__(:attributes)
    deps/ex_doc/lib/ex_doc/retriever.ex:208: ExDoc.Retriever.callbacks_of/1
    deps/ex_doc/lib/ex_doc/retriever.ex:203: ExDoc.Retriever."-callback_implementations/1-fun-1-"/1
    /home/shk/work/elixir/lib/elixir/lib/enum.ex:675: Enum."-map/2-lc$^0/1-0-"/2
    deps/ex_doc/lib/ex_doc/retriever.ex:203: ExDoc.Retriever.callback_implementations/1
    deps/ex_doc/lib/ex_doc/retriever.ex:88: ExDoc.Retriever.generate_node/3
    /home/shk/work/elixir/lib/elixir/lib/enum.ex:675: Enum."-map/2-lc$^0/1-0-"/2
    /home/shk/work/elixir/lib/elixir/lib/enum.ex:675: Enum."-map/2-lc$^0/1-0-"/2

Any ideas?

Wrong instructions for CLI usage

A weird thing happened. I clearly remember changing the README here because I was able to generate docs for a project that way. And it corresponds with the usage docstring.

Today I was getting this error on two different projects – https://github.com/elixir-lang/ex_doc/blob/master/lib/ex_doc/retriever.ex#L53-L54. If you examine the code path leading to this line, it doesn't add the directory where the beams are to the load path. So the user still needs to run ex_doc with elixir -pa path/to/ebin ex_doc <project name> <version> path/to/ebin.

I thought ex_doc would append the path automatically. Users don't have to know it relies on Code.ensure_loaded?.

Build problem on Ubuntu

Attempting to do a mix compile, and get this:

david@ubuntu:~/ex_doc$ mix compile
git submodule update --init
Submodule 'sundown' () registered for path 'sundown'
From git://github.com/vmg/sundown
 * [new branch]      gh-pages   -> origin/gh-pages
 * [new branch]      master     -> origin/master
Submodule path 'sundown': checked out '975df6267cbc798ecfcb6948364cd978dc2bf36f'
cd sundown && make
make[1]: Entering directory `/home/david/ex_doc/sundown'
gcc -c -g -O3 -fPIC -Wall -Werror -Wsign-compare -Isrc -Ihtml   -c -o src/markdown.o src/markdown.c
gcc -c -g -O3 -fPIC -Wall -Werror -Wsign-compare -Isrc -Ihtml   -c -o src/stack.o src/stack.c
gcc -c -g -O3 -fPIC -Wall -Werror -Wsign-compare -Isrc -Ihtml   -c -o src/buffer.o src/buffer.c
gcc -c -g -O3 -fPIC -Wall -Werror -Wsign-compare -Isrc -Ihtml   -c -o src/autolink.o src/autolink.c
gcc -c -g -O3 -fPIC -Wall -Werror -Wsign-compare -Isrc -Ihtml   -c -o html/html.o html/html.c
gcc -c -g -O3 -fPIC -Wall -Werror -Wsign-compare -Isrc -Ihtml   -c -o html/html_smartypants.o html/html_smartypants.c
gcc -c -g -O3 -fPIC -Wall -Werror -Wsign-compare -Isrc -Ihtml   -c -o html/houdini_html_e.o html/houdini_html_e.c
gcc -c -g -O3 -fPIC -Wall -Werror -Wsign-compare -Isrc -Ihtml   -c -o html/houdini_href_e.o html/houdini_href_e.c
gcc -g -O3 -Wall -Werror  -shared -Wl src/markdown.o src/stack.o src/buffer.o src/autolink.o html/html.o html/html_smartypants.o html/houdini_html_e.o html/houdini_href_e.o -o libsundown.so.1
gcc: error: unrecognized command line option ‘-Wl’
make[1]: *** [libsundown.so.1] Error 1
make[1]: Leaving directory `/home/david/ex_doc/sundown'
make: *** [sundown/libsundown.so] Error 2

gcc -version gives me this:

gcc (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2

Provide a docs.all task

The idea of the docs.all task is to go through all dependencies in a project and generate their documentation inside docs/PROJECT. Then generate an index file with links to each project and put it in docs/index.html. This way, developers will have easy access to the documentation of all dependencies in a given project.

In order for this to work, we should also change the default target of the mix docs task to be docs/PROJECT.

Problems compiling ex_doc

$ mix -v
Elixir 0.10.4-dev

/projects/ex_doc$ mix compile
** (ArgumentError) argument error
:io.put_chars(#PID<0.24.0>, :unicode, [<<109, 97, 107, 101, 58, 32, 34, 112, 114, 105, 118, 47, 109, 97, 114, 107, 100, 111, 119, 110, 46, 115, 111, 34, 32, 228, 114, 32, 102, 228, 114, 115, 107, 46, 10>>, 10])
/projects/elixir/lib/mix/lib/mix/tasks/compile.ex:78: Mix.Tasks.Compile."-run/1-fun-2-"/2
/projects/elixir/lib/elixir/lib/enum.ex:675: Enum."-map/2-lc$^0/1-0-"/2
/projects/elixir/lib/mix/lib/mix/tasks/compile.ex:77: Mix.Tasks.Compile.run/1
/projects/elixir/lib/mix/lib/mix/cli.ex:61: Mix.CLI.run_task/2

Ubuntu Build Problem

This may be related to #31

I had a report in the book errata page:

Fetching and building the ex_doc dependency leads to errors on ubuntu 13.04.

Fix is to edit deps/ex_doc/sundown/Makefile and remove the "-Wl" on line 44, then run mix deps.compile to fix up.--Ant Skelton

Missing file?

Hey, I'm trying to create some docs here.

Seems like ex_docs are looking for a file that can't be found. Did we loose it somewhere along the line, or should I have it from somewhere else?

$ mix docs

=ERROR REPORT==== 31-May-2013::23:14:38 ===
Error in process <0.79.0> with exit value: {{badmatch,{error,{load_failed,"Failed to load NIF library: '/home/kitofr/code/elixir/issues/deps/ex_doc/share/markdown.so: cannot open shared object file: No such file or directory'"}}},[{'Elixir.Markdown'...

Build fail on MacOSX

I build according to "Using ExDoc via command line" in README and I get the following error message.

/Users/yuki_ito/dev% git clone [email protected]:elixir-lang/ex_doc.git
Cloning into 'ex_doc'...
remote: Counting objects: 1293, done.
remote: Compressing objects: 100% (738/738), done.
remote: Total 1293 (delta 520), reused 1274 (delta 507)
Receiving objects: 100% (1293/1293), 388.55 KiB | 186 KiB/s, done.
Resolving deltas: 100% (520/520), done.
/Users/yuki_ito/dev% cd ex_doc/
/Users/yuki_ito/dev/ex_doc% mix compile
git submodule update --init
Submodule 'sundown' (git://github.com/vmg/sundown.git) registered for path 'sundown'
Cloning into 'sundown'...
Submodule path 'sundown': checked out '975df6267cbc798ecfcb6948364cd978dc2bf36f'
cd sundown && make
gcc -c -g -O3 -fPIC -Wall -Werror -Wsign-compare -Isrc -Ihtml   -c -o src/markdown.o src/markdown.c
gcc -c -g -O3 -fPIC -Wall -Werror -Wsign-compare -Isrc -Ihtml   -c -o src/stack.o src/stack.c
gcc -c -g -O3 -fPIC -Wall -Werror -Wsign-compare -Isrc -Ihtml   -c -o src/buffer.o src/buffer.c
gcc -c -g -O3 -fPIC -Wall -Werror -Wsign-compare -Isrc -Ihtml   -c -o src/autolink.o src/autolink.c
gcc -c -g -O3 -fPIC -Wall -Werror -Wsign-compare -Isrc -Ihtml   -c -o html/html.o html/html.c
gcc -c -g -O3 -fPIC -Wall -Werror -Wsign-compare -Isrc -Ihtml   -c -o html/html_smartypants.o html/html_smartypants.c
gcc -c -g -O3 -fPIC -Wall -Werror -Wsign-compare -Isrc -Ihtml   -c -o html/houdini_html_e.o html/houdini_html_e.c
gcc -c -g -O3 -fPIC -Wall -Werror -Wsign-compare -Isrc -Ihtml   -c -o html/houdini_href_e.o html/houdini_href_e.c
gcc -g -O3 -Wall -Werror  -shared -Wl src/markdown.o src/stack.o src/buffer.o src/autolink.o html/html.o html/html_smartypants.o html/houdini_html_e.o html/houdini_href_e.o -o libsundown.so.1
ln -f -s libsundown.so.1 libsundown.so
gcc -c -g -O3 -fPIC -Wall -Werror -Wsign-compare -Isrc -Ihtml   -c -o examples/sundown.o examples/sundown.c
gcc -g -O3 -Wall -Werror  examples/sundown.o src/markdown.o src/stack.o src/buffer.o src/autolink.o html/html.o html/html_smartypants.o html/houdini_html_e.o html/houdini_href_e.o -o sundown
gcc -c -g -O3 -fPIC -Wall -Werror -Wsign-compare -Isrc -Ihtml   -c -o examples/smartypants.o examples/smartypants.c
gcc -g -O3 -Wall -Werror  examples/smartypants.o src/markdown.o src/stack.o src/buffer.o src/autolink.o html/html.o html/html_smartypants.o html/houdini_html_e.o html/houdini_href_e.o -o smartypants
gcc -g -O3 -fPIC -Isundown/src -Isundown/html -I/usr/local/lib/erlang/erts-5.10.1/include -shared -dynamiclib -undefined dynamic_lookup -o share/markdown.so sundown/html/html.o sundown/html/html_smartypants.o sundown/html/houdini_html_e.o sundown/html/houdini_href_e.o sundown/src/buffer.o sundown/src/autolink.o sundown/src/stack.o sundown/src/markdown.o src/markdown_nif.c src/render_ansi.c

Compiled lib/ex_doc/cli.ex

=ERROR REPORT==== 15-May-2013::19:36:48 ===
Error in process <0.68.0> with exit value: {{badmatch,{error,{load_failed,"Failed to load NIF library: 'dlopen(/Users/yuki_ito/dev/ex_doc/share/markdown.so, 2): no suitable image found.  Did find:\n  /Users/yuki_ito/dev/ex_doc/share/markdown.so:... 


=ERROR REPORT==== 15-May-2013::19:36:48 ===
The on_load function for module Elixir-Markdown returned {{badmatch,
                                                           {error,
                                                            {load_failed,
                                                             "Failed to load NIF library: 'dlopen(/Users/yuki_ito/dev/ex_doc/share/markdown.so, 2): no suitable image found.  Did find:\n\t/Users/yuki_ito/dev/ex_doc/share/markdown.so: mach-o, but wrong architecture'"}}},
                                                          [{'Elixir-Markdown',
                                                            init,0,
                                                            [{file,...},
                                                             {...}]},
                                                           {code_server,
                                                            '-handle_on_load/4-fun-0-',
                                                            1,
                                                            [{...}|...]}]}
Compiled lib/markdown.ex
Compiled lib/mix_docs.ex
Compiled lib/ex_doc.ex
Compiled lib/ex_doc/html_formatter.ex
Compiled lib/ex_doc/retriever.ex
Generated ex_doc.app

I use Max OS X 10.7.4, Erlang R16B and Elixir master branch.

iex info

/Users/yuki_ito/% iex
Erlang R16B (erts-5.10.1) [source] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Interactive Elixir (0.8.3.dev) - press Ctrl+C to exit (type h() ENTER for help)

gcc info

/Users/yuki_ito% gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Create custom mix task that will create/checkout gh-pages branch, generate, then push

I think it would be a good idea to make publishing docs as quickly as possible. With github project pages we can publish static html quickly.

I would like to create a mix task named docs.publish or docs.gh-pages that would

  1. verify we are in a git repo
  2. either create or checkout an orphan branch named gh-pages in a directory called "docs"
  3. run "mix docs"
  4. push that branch to github

I'm looking for a nod of approval before I write the code and create a PR.
I think adding it to ex_doc directly instead of another package would make this easy for folks to get in the habit of publishing docs.

Can't generate documentation on OS X Lion

Crashes with the following error:

** (UndefinedFunctionError) undefined function: Macro.to_string/1
    Macro.to_string({:main,0,[{:args,[line: 2],nil}]})
    /Users/chee/elixir/issues/deps/ex_doc/lib/templates/detail_template.eex:3: ExDoc.HTMLFormatter.detail_template/1
    /Users/chee/elixir/issues/deps/ex_doc/lib/templates/module_template.eex:88: ExDoc.HTMLFormatter."-module_template/6-lc$^5/1-5-"/1
    /Users/chee/elixir/issues/deps/ex_doc/lib/templates/module_template.eex:88: ExDoc.HTMLFormatter.module_template/6
    /Users/chee/elixir/issues/deps/ex_doc/lib/ex_doc.ex:81: ExDoc.generate_module_page/4
    /Users/chee/elixir/issues/deps/ex_doc/lib/ex_doc.ex:75: ExDoc.generate_list/5
    lists.erl:1323: :lists.foreach/2
    /Users/chee/elixir/lib/elixir/lib/enum.ex:284: Enum.each/2


Kernel.++/2 doesn't autolink

Kernel.++/2 doesn't appear to auto-link in the docs. Probably need to update the regex for discovering functions. Should also validate other special forms.

Module list should be consistent

Right now, e.g. GenServer.Behaviour shows up with its full module name in the module list. This is of course because there's no GenServer parent module, but the behavior is rather confusing to someone not in the know; it gives the impression that other modules don't have submodules (e.g. Kernel.SpecialForms isn't in the list). With the current behavior, submodules also aren't very discoverable in general.

I see two ways to deal with this:

  • List all modules in the list with their full name. This makes modules a lot more discoverable when just browsing through the list and adds no confusion. It does have the potential to be overwhelming when there are lots of modules and lots of hierarchies, however.
  • Consistently put modules under their parent module. This would mean that e.g. GenServer would either not be clickable or would just show a page saying "nothing here". This doesn't really solve the discoverability issue, though.

Thoughts? Any other ideas?

Umbrella project support

Placing the ExDoc dependency in the mix.exs file at the root of an umbrella project and running mix docs does not generate documentation for each application found within your apps directory.

It would be awesome to be able to manipulate documentation at the umbrella level!

Adding user's guides

We'd like to be able to add user's guides to our documentation, like Erlang has.

The current plan is to allow passing a list of markdown files to ex_doc which will be used as the user's guide. Directories can be passed as well, those are expanded to the files in them (alphabetically).

Does not compile with Elixir v0.13.2

Is there a reason why ex_doc is not versioned? I'm getting build errors. I suppose I'll have to fork and roll back changes to get a version to compile. Any other suggestions?

Thanks

Discuss how we should handle default values

Today, functions can have default values, as in:

def foo(bar // 0)

But Elixir does not leak this information. This means we can't know if a given function was generated from a default clause and we need to fix that first in Elixir and then port the features here.

Can't compile ExDoc on Windows

tovmasyan@input255 ~/ex_doc
$ mix test
src/markdown.c:1:0: error: -fPIC ignored for target (all code is position indepe
ndent) [-Werror]
cc1.exe: all warnings being treated as errors
make[1]: *** [src/markdown.o] Error 1
make: *** [sundown/libsundown.so] Error 2
cd sundown && make
make[1]: Entering directory /u/ex_doc/sundown' gcc -c -g -O3 -fPIC -Wall -Werror -Wsign-compare -Isrc -Ihtml -c -o src/markdo wn.o src/markdown.c make[1]: Leaving directory/u/ex_doc/sundown'

=ERROR REPORT==== 1-Jul-2013::17:42:14 ===
Error in process <0.73.0> with exit value: {{badmatch,{error,{load_failed,"Faile
d to load NIF library u:/ex_doc/share/markdown: '├Н├е ├н├а├й├д├е├н ├│├к├а├з├а├н├
н├╗├й ├м├о├д├│├л├╝.'"}}},[{'Elixir.Markdown',init,0,[{file,"u:/ex_doc/lib/markdo
wn.ex"},{line,6}]},{code_server,'-handle_on_load/4-fun-0-'...

=ERROR REPORT==== 1-Jul-2013::17:42:14 ===
The on_load function for module Elixir.Markdown returned {{badmatch,
{error,
{load_failed,
"Failed to load NIF
library u:/ex_doc/share/markdown: '├Н├е ├н├а├й├д├е├н ├│├к├а├з├а├н├н├╗├й ├м├о├д├
│├л├╝.'"}}},
[{'Elixir.Markdown',
init,0,
[{file,...},
{...}]},
{code_server,
'-handle_on_load/4-f
un-0-',
1,
[{...}|...]}]}

=ERROR REPORT==== 1-Jul-2013::17:42:14 ===
Error in process <0.75.0> with exit value: {{badmatch,{error,{load_failed,"Faile
d to load NIF library u:/ex_doc/share/markdown: '├Н├е ├н├а├й├д├е├н ├│├к├а├з├а├н├
н├╗├й ├м├о├д├│├л├╝.'"}}},[{'Elixir.Markdown',init,0,[{file,"u:/ex_doc/lib/markdo
wn.ex"},{line,6}]},{code_server,'-handle_on_load/4-fun-0-'...

=ERROR REPORT==== 1-Jul-2013::17:42:14 ===
The on_load function for module Elixir.Markdown returned {{badmatch,
{error,
{load_failed,
"Failed to load NIF
library u:/ex_doc/share/markdown: '├Н├е ├н├а├й├д├е├н ├│├к├а├з├а├н├н├╗├й ├м├о├д├
│├л├╝.'"}}},
[{'Elixir.Markdown',
init,0,
[{file,...},
{...}]},
{code_server,
'-handle_on_load/4-f
un-0-',
1,
[{...}|...]}]}

=ERROR REPORT==== 1-Jul-2013::17:42:14 ===
Error in process <0.77.0> with exit value: {{badmatch,{error,{load_failed,"Faile
d to load NIF library u:/ex_doc/share/markdown: '├Н├е ├н├а├й├д├е├н ├│├к├а├з├а├н├
н├╗├й ├м├о├д├│├л├╝.'"}}},[{'Elixir.Markdown',init,0,[{file,"u:/ex_doc/lib/markdo
wn.ex"},{line,6}]},{code_server,'-handle_on_load/4-fun-0-'...

=ERROR REPORT==== 1-Jul-2013::17:42:14 ===
The on_load function for module Elixir.Markdown returned {{badmatch,
{error,
{load_failed,
"Failed to load NIF
library u:/ex_doc/share/markdown: '├Н├е ├н├а├й├д├е├н ├│├к├а├з├а├н├н├╗├й ├м├о├д├
│├л├╝.'"}}},
[{'Elixir.Markdown',
init,0,
[{file,...},
{...}]},
{code_server,
'-handle_on_load/4-f
un-0-',
1,
[{...}|...]}]}

=ERROR REPORT==== 1-Jul-2013::17:42:14 ===
Error in process <0.85.0> with exit value: {{badmatch,{error,{load_failed,"Faile
d to load NIF library u:/ex_doc/share/markdown: '├Н├е ├н├а├й├д├е├н ├│├к├а├з├а├н├
н├╗├й ├м├о├д├│├л├╝.'"}}},[{'Elixir.Markdown',init,0,[{file,"u:/ex_doc/lib/markdo
wn.ex"},{line,6}]},{code_server,'-handle_on_load/4-fun-0-'...

=ERROR REPORT==== 1-Jul-2013::17:42:14 ===
The on_load function for module Elixir.Markdown returned {{badmatch,
{error,
{load_failed,
"Failed to load NIF
library u:/ex_doc/share/markdown: '├Н├е ├н├а├й├д├е├н ├│├к├а├з├а├н├н├╗├й ├м├о├д├
│├л├╝.'"}}},
[{'Elixir.Markdown',
init,0,
[{file,...},
{...}]},
{code_server,
'-handle_on_load/4-f
un-0-',
1,
[{...}|...]}]}
F
=ERROR REPORT==== 1-Jul-2013::17:42:15 ===
Error in process <0.88.0> with exit value: {{badmatch,{error,{load_failed,"Faile
d to load NIF library u:/ex_doc/share/markdown: '├Н├е ├н├а├й├д├е├н ├│├к├а├з├а├н├
н├╗├й ├м├о├д├│├л├╝.'"}}},[{'Elixir.Markdown',init,0,[{file,"u:/ex_doc/lib/markdo
wn.ex"},{line,6}]},{code_server,'-handle_on_load/4-fun-0-'...

F
=ERROR REPORT==== 1-Jul-2013::17:42:15 ===
The on_load function for module Elixir.Markdown returned {{badmatch,
{error,
{load_failed,
"Failed to load NIF
library u:/ex_doc/share/markdown: '├Н├е ├н├а├й├д├е├н ├│├к├а├з├а├н├н├╗├й ├м├о├д├
│├л├╝.'"}}},
[{'Elixir.Markdown',
init,0,
[{file,...},
{...}]},
{code_server,
'-handle_on_load/4-f
un-0-',
1,
[{...}|...]}]}

=ERROR REPORT==== 1-Jul-2013::17:42:15 ===
Error in process <0.91.0> with exit value: {{badmatch,{error,{load_failed,"Faile
d to load NIF library u:/ex_doc/share/markdown: '├Н├е ├н├а├й├д├е├н ├│├к├а├з├а├н├
н├╗├й ├м├о├д├│├л├╝.'"}}},[{'Elixir.Markdown',init,0,[{file,"u:/ex_doc/lib/markdo
wn.ex"},{line,6}]},{code_server,'-handle_on_load/4-fun-0-'...

=ERROR REPORT==== 1-Jul-2013::17:42:15 ===
The on_load function for module Elixir.Markdown returned {{badmatch,
{error,
{load_failed,
"Failed to load NIF
library u:/ex_doc/share/markdown: '├Н├е ├н├а├й├д├е├н ├│├к├а├з├а├н├н├╗├й ├м├о├д├
│├л├╝.'"}}},
[{'Elixir.Markdown',
init,0,
[{file,...},
{...}]},
{code_server,
'-handle_on_load/4-f
un-0-',
1,
[{...}|...]}]}
F
=ERROR REPORT==== 1-Jul-2013::17:42:16 ===
Error in process <0.97.0> with exit value: {{badmatch,{error,{load_failed,"Faile
d to load NIF library u:/ex_doc/share/markdown: '├Н├е ├н├а├й├д├е├н ├│├к├а├з├а├н├
н├╗├й ├м├о├д├│├л├╝.'"}}},[{'Elixir.Markdown',init,0,[{file,"u:/ex_doc/lib/markdo
wn.ex"},{line,6}]},{code_server,'-handle_on_load/4-fun-0-'...

=ERROR REPORT==== 1-Jul-2013::17:42:16 ===
The on_load function for module Elixir.Markdown returned {{badmatch,
{error,
{load_failed,
"Failed to load NIF
library u:/ex_doc/share/markdown: '├Н├е ├н├а├й├д├е├н ├│├к├а├з├а├н├н├╗├й ├м├о├д├
│├л├╝.'"}}},
[{'Elixir.Markdown',
init,0,
[{file,...},
{...}]},
{code_server,
'-handle_on_load/4-f
un-0-',
1,
[{...}|...]}]}
F

=ERROR REPORT==== 1-Jul-2013::17:37:27 ===
The on_load function for module Elixir.Markdown returned {{badmatch,
{error,
{load_failed,
"Failed to load NIF
library u:/ex_doc/share/markdown: '├Н├е ├н├а├й├д├е├н ├│├к├а├з├а├н├н├╗├й ├м├о├д├
│├л├╝.'"}}},
[{'Elixir.Markdown',
init,0,
[{file,...},
{...}]},
{code_server,
'-handle_on_load/4-f
un-0-',
1,
[{...}|...]}]}
F
=ERROR REPORT==== 1-Jul-2013::17:37:28 ===
Error in process <0.151.0> with exit value: {{badmatch,{error,{load_failed,"Fail
ed to load NIF library u:/ex_doc/share/markdown: '├Н├е ├н├а├й├д├е├н ├│├к├а├з├а├н
├н├╗├й ├м├о├д├│├л├╝.'"}}},[{'Elixir.Markdown',init,0,[{file,"u:/ex_doc/lib/markd
own.ex"},{line,6}]},{code_server,'-handle_on_load/4-fun-0-'...

=ERROR REPORT==== 1-Jul-2013::17:37:28 ===
The on_load function for module Elixir.Markdown returned {{badmatch,
{error,
{load_failed,
"Failed to load NIF
library u:/ex_doc/share/markdown: '├Н├е ├н├а├й├д├е├н ├│├к├а├з├а├н├н├╗├й ├м├о├д├
│├л├╝.'"}}},
[{'Elixir.Markdown',
init,0,
[{file,...},
{...}]},
{code_server,
'-handle_on_load/4-f
un-0-',
1,
[{...}|...]}]}
F
=ERROR REPORT==== 1-Jul-2013::17:37:30 ===
Error in process <0.155.0> with exit value: {{badmatch,{error,{load_failed,"Fail
ed to load NIF library u:/ex_doc/share/markdown: '├Н├е ├н├а├й├д├е├н ├│├к├а├з├а├н
├н├╗├й ├м├о├д├│├л├╝.'"}}},[{'Elixir.Markdown',init,0,[{file,"u:/ex_doc/lib/markd
own.ex"},{line,6}]},{code_server,'-handle_on_load/4-fun-0-'...

=ERROR REPORT==== 1-Jul-2013::17:37:30 ===
The on_load function for module Elixir.Markdown returned {{badmatch,
{error,
{load_failed,
"Failed to load NIF
library u:/ex_doc/share/markdown: '├Н├е ├н├а├й├д├е├н ├│├к├а├з├а├н├н├╗├й ├м├о├д├
│├л├╝.'"}}},
[{'Elixir.Markdown',
init,0,
[{file,...},
{...}]},
{code_server,
'-handle_on_load/4-f
un-0-',
1,
[{...}|...]}]}
F
=ERROR REPORT==== 1-Jul-2013::17:37:31 ===
The on_load function for module Elixir.Markdown returned {{badmatch,
{error,
{load_failed,
"Failed to load NIF
library u:/ex_doc/share/markdown: '├Н├е ├н├а├й├д├е├н ├│├к├а├з├а├н├н├╗├й ├м├о├д├
│├л├╝.'"}}},
[{'Elixir.Markdown',
init,0,
[{file,...},
{...}]},
{code_server,
'-handle_on_load/4-f
un-0-',
1,
[{...}|...]}]}

=ERROR REPORT==== 1-Jul-2013::17:37:31 ===
Error in process <0.159.0> with exit value: {{badmatch,{error,{load_failed,"Fail
ed to load NIF library u:/ex_doc/share/markdown: '├Н├е ├н├а├й├д├е├н ├│├к├а├з├а├н
├н├╗├й ├м├о├д├│├л├╝.'"}}},[{'Elixir.Markdown',init,0,[{file,"u:/ex_doc/lib/markd
own.ex"},{line,6}]},{code_server,'-handle_on_load/4-fun-0-'...

F........................
=ERROR REPORT==== 1-Jul-2013::17:37:33 ===
Error in process <0.190.0> with exit value: {{badmatch,{error,{load_failed,"Fail
ed to load NIF library u:/ex_doc/share/markdown: '├Н├е ├н├а├й├д├е├н ├│├к├а├з├а├н
├н├╗├й ├м├о├д├│├л├╝.'"}}},[{'Elixir.Markdown',init,0,[{file,"u:/ex_doc/lib/markd
own.ex"},{line,6}]},{code_server,'-handle_on_load/4-fun-0-'...

=ERROR REPORT==== 1-Jul-2013::17:37:33 ===
The on_load function for module Elixir.Markdown returned {{badmatch,
{error,
{load_failed,
"Failed to load NIF
library u:/ex_doc/share/markdown: '├Н├е ├н├а├й├д├е├н ├│├к├а├з├а├н├н├╗├й ├м├о├д├
│├л├╝.'"}}},
[{'Elixir.Markdown',
init,0,
[{file,...},
{...}]},
{code_server,
'-handle_on_load/4-f
un-0-',
1,
[{...}|...]}]}
F...
=ERROR REPORT==== 1-Jul-2013::17:37:33 ===
Error in process <0.196.0> with exit value: {{badmatch,{error,{load_failed,"Fail
ed to load NIF library u:/ex_doc/share/markdown: '├Н├е ├н├а├й├д├е├н ├│├к├а├з├а├н
├н├╗├й ├м├о├д├│├л├╝.'"}}},[{'Elixir.Markdown',init,0,[{file,"u:/ex_doc/lib/markd
own.ex"},{line,6}]},{code_server,'-handle_on_load/4-fun-0-'...

=ERROR REPORT==== 1-Jul-2013::17:37:33 ===
The on_load function for module Elixir.Markdown returned {{badmatch,
{error,
{load_failed,
"Failed to load NIF
library u:/ex_doc/share/markdown: '├Н├е ├н├а├й├д├е├н ├│├к├а├з├а├н├н├╗├й ├м├о├д├
│├л├╝.'"}}},
[{'Elixir.Markdown',
init,0,
[{file,...},
{...}]},
{code_server,
'-handle_on_load/4-f
un-0-',
1,
[{...}|...]}]}
F
=ERROR REPORT==== 1-Jul-2013::17:37:33 ===
Error in process <0.199.0> with exit value: {{badmatch,{error,{load_failed,"Fail
ed to load NIF library u:/ex_doc/share/markdown: '├Н├е ├н├а├й├д├е├н ├│├к├а├з├а├н
├н├╗├й ├м├о├д├│├л├╝.'"}}},[{'Elixir.Markdown',init,0,[{file,"u:/ex_doc/lib/markd
own.ex"},{line,6}]},{code_server,'-handle_on_load/4-fun-0-'...

=ERROR REPORT==== 1-Jul-2013::17:37:33 ===
The on_load function for module Elixir.Markdown returned {{badmatch,
{error,
{load_failed,
"Failed to load NIF
library u:/ex_doc/share/markdown: '├Н├е ├н├а├й├д├е├н ├│├к├а├з├а├н├н├╗├й ├м├о├д├
│├л├╝.'"}}},
[{'Elixir.Markdown',
init,0,
[{file,...},
{...}]},
{code_server,
'-handle_on_load/4-f
un-0-',
1,
[{...}|...]}]}
F.....

Failures:

  1. test to_html autolink http address (MarkdownTest)
    ** (UndefinedFunctionError) undefined function: Markdown.to_html/1
    stacktrace:
    Markdown.to_html("https://github.com/elixir-lang")
    test/markown_test.exs:18: MarkdownTest."test to_html autolink http addres
    s"/1

  2. test to_html generate the HTML from the markdown (MarkdownTest)
    ** (UndefinedFunctionError) undefined function: Markdown.to_html/1
    stacktrace:
    Markdown.to_html("# Test")
    test/markown_test.exs:7: MarkdownTest."test to_html generate the HTML fro
    m the markdown"/1

  3. test to_html raises an ArgumentError if the value passed is nil (MarkdownTe
    st)
    ** (ExUnit.AssertionError) Expected exception ArgumentError, got UndefinedF
    unctionError (undefined function: Markdown.to_html/1)
    at test/markown_test.exs:11

  4. test generate_docs accepts relative directories (ExDocTest)
    ** (UndefinedFunctionError) undefined function: Markdown.to_html/1
    stacktrace:
    Markdown.to_html("moduledoc\n\n## Example\n CompiledWithDocs.example\n
    ")
    lib/templates/module_template.eex:32: ExDoc.HTMLFormatter.module_template
    /6
    lib/ex_doc.ex:81: ExDoc.generate_module_page/4
    lib/ex_doc.ex:75: ExDoc.generate_list/5
    u:/elixir/lib/elixir/lib/enum.ex:293: Enum."-each/2-lists^foreach/1-0-"/2

   u:/elixir/lib/elixir/lib/enum.ex:293: Enum.each/2
   test/exdoc_test.exs:29: ExDocTest."test generate_docs accepts relative di

rectories"/1

  1. test generate_docs generates all listing files (ExDocTest)
    ** (UndefinedFunctionError) undefined function: Markdown.to_html/1
    stacktrace:
    Markdown.to_html("moduledoc\n\n## Example\n CompiledWithDocs.example\n
    ")
    lib/templates/module_template.eex:32: ExDoc.HTMLFormatter.module_template
    /6
    lib/ex_doc.ex:81: ExDoc.generate_module_page/4
    lib/ex_doc.ex:75: ExDoc.generate_list/5
    u:/elixir/lib/elixir/lib/enum.ex:293: Enum."-each/2-lists^foreach/1-0-"/2
   u:/elixir/lib/elixir/lib/enum.ex:293: Enum.each/2
   test/exdoc_test.exs:45: ExDocTest."test generate_docs generates all listi

ng files"/1

  1. test generate_docs generates in specified output directory (ExDocTest)
    ** (UndefinedFunctionError) undefined function: Markdown.to_html/1
    stacktrace:
    Markdown.to_html("moduledoc\n\n## Example\n CompiledWithDocs.example\n
    ")
    lib/templates/module_template.eex:32: ExDoc.HTMLFormatter.module_template
    /6
    lib/ex_doc.ex:81: ExDoc.generate_module_page/4
    lib/ex_doc.ex:75: ExDoc.generate_list/5
    u:/elixir/lib/elixir/lib/enum.ex:293: Enum."-each/2-lists^foreach/1-0-"/2
   u:/elixir/lib/elixir/lib/enum.ex:293: Enum.each/2
   test/exdoc_test.exs:35: ExDocTest."test generate_docs generates in specif

ied output directory"/1

  1. test generate_docs generates the html file with the documentation (ExDocTes
    t)
    ** (UndefinedFunctionError) undefined function: Markdown.to_html/1
    stacktrace:
    Markdown.to_html("moduledoc\n\n## Example\n CompiledWithDocs.example\n
    ")
    lib/templates/module_template.eex:32: ExDoc.HTMLFormatter.module_template
    /6
    lib/ex_doc.ex:81: ExDoc.generate_module_page/4
    lib/ex_doc.ex:75: ExDoc.generate_list/5
    u:/elixir/lib/elixir/lib/enum.ex:293: Enum."-each/2-lists^foreach/1-0-"/2
   u:/elixir/lib/elixir/lib/enum.ex:293: Enum.each/2
   test/exdoc_test.exs:23: ExDocTest."test generate_docs generates the html

file with the documentation"/1

  1. test generate_docs generates the source link with the specified url (ExDocT
    est)
    ** (UndefinedFunctionError) undefined function: Markdown.to_html/1
    stacktrace:
    Markdown.to_html("moduledoc\n\n## Example\n CompiledWithDocs.example\n
    ")
    lib/templates/module_template.eex:32: ExDoc.HTMLFormatter.module_template
    /6
    lib/ex_doc.ex:81: ExDoc.generate_module_page/4
    lib/ex_doc.ex:75: ExDoc.generate_list/5
    u:/elixir/lib/elixir/lib/enum.ex:293: Enum."-each/2-lists^foreach/1-0-"/2
   u:/elixir/lib/elixir/lib/enum.ex:293: Enum.each/2
   test/exdoc_test.exs:65: ExDocTest."test generate_docs generates the sourc

e link with the specified url"/1

  1. test module_page outputs behavior and callbacks (ExDoc.HTMLFormatterTest)
    ** (UndefinedFunctionError) undefined function: Markdown.to_html/1
    stacktrace:
    Markdown.to_html("This is a sample callback.\n")
    lib/templates/detail_template.eex:5: ExDoc.HTMLFormatter.detail_template/
    1
    lib/templates/module_template.eex:102: ExDoc.HTMLFormatter."-module_templ
    ate/6-lc$^7/1-7-"/1
    lib/templates/module_template.eex:102: ExDoc.HTMLFormatter.module_templat
    e/6
    test/exdoc/html_formatter_test.exs:62: ExDoc.HTMLFormatterTest."test modu
    le_page outputs behavior and callbacks"/1

  2. test module_page outputs summaries (ExDoc.HTMLFormatterTest)
    ** (UndefinedFunctionError) undefined function: Markdown.to_html/1
    stacktrace:
    Markdown.to_html("moduledoc\n\n## Example\n CompiledWithDocs.example\n
    ")
    lib/templates/module_template.eex:32: ExDoc.HTMLFormatter.module_template
    /6
    test/exdoc/html_formatter_test.exs:55: ExDoc.HTMLFormatterTest."test modu
    le_page outputs summaries"/1

  3. test module_page outputs the functions and docstrings (ExDoc.HTMLFormatter
    Test)
    ** (UndefinedFunctionError) undefined function: Markdown.to_html/1
    stacktrace:
    Markdown.to_html("moduledoc\n\n## Example\n CompiledWithDocs.example\n
    ")
    lib/templates/module_template.eex:32: ExDoc.HTMLFormatter.module_template
    /6
    test/exdoc/html_formatter_test.exs:41: ExDoc.HTMLFormatterTest."test modu
    le_page outputs the functions and docstrings"/1

Finished in 13.8 seconds (4.3s on load, 9.5s on tests)
43 tests, 11 failures

tovmasyan@input255 ~/ex_doc
$

Update to Elixir v0.14.0

We need to upgrade to Elixir v0.14.0-dev:

  • v0.14.0 no longer supports module.__info__(:docs). Instead Code.get_docs(module, :all) should be used
  • There are no longer records in v0.14.0-dev. We should remove support for records in ExDoc and instead check if the module defines a __struct__ function. If such function is defined and its documentation is not set to false, we are going to tag it as struct. We will also detect exceptions similarly if the struct has an exception field
  • We are going to get rid of the Modules | Records | Protocols pages in favor of a single listing. We will still keep the tags so they are shown along side the module name in the module page, but we will no longer break the listing

Include @specs in Documentation?

Hi, is it possible to include any @specs in the docs ? If its possible and you'd consider a PR could you give me a hint of how it might be done? I can't see how to get them out of __ info __ or otherwise retrieve the @specs and @types for a module.

Issues in the current implementation

The current implementation of ExDoc contains a series of issues, I would like to fix in the long term. The most prominent consequence of those issues is the difficulty in testing, either because the APIs are not well exposed or because the different modules are too coupled. The main issues are:

  1. ExDoc as the main driver for logic. Initially we have thought about having ExDoc driving the main logic by simply calling functions on the formatter. This approach limits greatly what the compiler can achieve. My proposal is to change ExDoc to simply call: formatter.run(data, config) and let the formatter do whatever it pleases. This will make it easy to unit test ExDoc, because we can simply create a dummy formatter that returns the given data and config. Data is meant to be the information returned from the retriever and config is the current ExDoc config record.

  2. The ExDoc.Retriever module was created with ExDoc in mind. Its only API is get_docs which expects a bunch of files, which, once again, make them hard to test. Instead I would like the retriever to work against a list of modules names, which is possible because aliases in Elixir can exist without the underlying module existing, like ThisIsUnknown. Again, the direct benefit is that testability becomes, because we can simply pass a module for testing, instead of having to generate actual beam files. My proposed API for this module would be:

    ExDoc.Retriever.docs_from_dir(dir, config)
    ExDoc.Retriever.docs_from_files(files, config)
    ExDoc.Retriever.docs_from_modules(files, config)

    docs_from_dir should simply do a wildcard on the given directory for ebin fles, which are then passed to files which then calls modules. I would also like to change the ExDoc.Retriever to return the full list of docs, without nesting or segregation by protocols or records. Nesting and segregation should be done by the underlying formatter on whatever way it pleases. We could provide helpers for such functionality either as extra functions in ExDoc.Retriever.

  3. Finally, since those changes will likely move more logic into the formatter, I would like to split the current formatter in two modules. One that will do the required assembling and another one only with the templates. Today, both templates and assembling are in the same module, which cases confusion. For example, it would be wise to still keep the parts that write to disk decoupled from the template, so we can test the template without a need to read and write to disk.

As the main goal here is provide a well documented and tested project, it is important to document and update tests as we go, getting rid of the old, coupled tests in favor of new ones.

Autolink erlang functions

Autolink erlang functions in the docs (of the form :module.fun/arity) to the erlang manual pages.

I've almost got a working version of this and will submit a PR soon.

Behaviour signatures removed from Elixir?

In elixir-lang/elixir@d33463d, @josevalim removed the signature info from the Behaviour docs. This is generating a match error in ExDoc.Retriever.get_callback/4, where we use the signature information in the ExDoc.FunctionNode. Does this information live some other place in the beam file? Or is there a better way to capture it for the docs?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.