Search code examples
erlangejabberderlang-otpejabberd-module

How to generate document for Ejabberd custom modules?


I have created some custom modules I need to create documentation for all my custom module So any help?


Solution

  • You can use edoc - http://erlang.org/doc/apps/edoc/chapter.html. Eg: test_edoc.erl

    -module(test_edoc).
    
    -export([run/1]).
    
    %% -------------------------------------------------------------------
    %% @doc
    %% Some description
    %% @end
    %% -------------------------------------------------------------------
    -spec run(N :: integer()) -> Result :: integer() | error.
    
    run(N) when is_integer(N) -> N + 1;
    run(_) -> error.
    

    Then in Erlang shell:

    1> edoc:files(["test_edoc.erl"], [{dir, doc}]).
    ok
    

    Then in current folder where you run edoc:files/2 should be generated the doc folder, so, go to the doc folder and open in browser test_edoc.html