Parsing and creating documentation at compile time

I am using the telegram bot boilerplate here https://github.com/lubien/elixir-telegram-bot-boilerplate. (Telegram is a messenger with medium security that is currently fighting and winning a digital war against the Russian Internet Providers).

Now I would like to generate automatic documentation which I can use to register and update my bot.
The code looks like this (command is a macro which I can adapt if that helps):

@doc "Replies with hello"
command "hello" do
# do something
end

@doc "Bar"
command "foo", do: #do something else

And the result should look like this:

hello - Replies with hello
foo - Bar

Ideally a mix task creates this documentation. Any idea how I go about this? Topics I can read? Libraries I can look at?

The most obvious library to look at would probably be ex_doc.

1 Like

Elixir 1.7 has a method for exactly this feature. https://hexdocs.pm/elixir/Code.html#fetch_docs/1.

1 Like