Task: Create Project Documentation

Java has Javadoc, Ruby has RDoc, and Elixir has ExDoc—a documentation tool that describes your project, showing the modules, the things defined in them, and any documentation you’ve written for them.

Using it is easy. First, add the ExDoc dependency to your mix.exs file. You’ll also need to add an output formatter—I use earmark, a pure-Elixir Markdown-to-HTML convertor.

 defp​ deps ​do
  [ ​httpoison:​ ​"​​~> 0.8"​,
 poison:​ ​"​​~> 1.5"​,
»ex_doc:​ ​"​​~> 0.11"​,
»earmark:​ ​"​​>= 0.0.0"​ ]
 end

While you’re in the mix.exs, you can add a project name and (if your project is in GitHub) a URL. The latter allows ExDoc to provide live links to your source code. These parameters go in the project function: ...

Get Programming Elixir 1.2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.