Step 5: Create Project Documentation
Learn about creating project documentation and coding by transforming data.
We'll cover the following
Java has Javadoc, Ruby has RDoc, and Elixir has ExDoc. These are documentation tools that describe our project by showing the modules, the things defined in them, and any documentation we’ve written for them.
Using it is easy. First, we add the ExDoc dependency to the mix.exs
file. We’ll also need to add an output formatter. We use earmark
, a pure Elixir Markdown-to-HTML convertor.
defp deps do [
{ :httpoison, "~> 1.0.0" },
{ :poison, "~> 3.1.0" },
{:ex_doc, "~> 0.18.1" },
{:earmark, "~> 1.2.4" },
]
end
While we’re in the mix.exs
file, we can add a project name and, if the project is in GitHub, a URL. The latter allows ExDoc to provide live links to the source code. These parameters go in the project
function:
def project do
[ app: :issues,
version: "0.0.1",
name: "Issues",
source_url: "https://github.com/pragdave/issues",
deps: deps ]
end
Click the “Run” button, open the “Output” session, click “OK,” type /5/issues/doc/index.html
in the browser, and then use the sidebar on the left to search or drill down through the modules.
Here’s what we see for the start of the documentation for TableFormatter
:
Get hands-on with 1400+ tech skills courses.