Why is the documentation I write missing from my types? (OTP25, rebar3_ex_doc)

Hi there!

I’m generating documentation for a project written in OTP 25, and I’m trying to document my -type attributes. I’ve tried several different approaches (%% @doc before, %% on the same line, and %% after the -type declaration. None of them work.)

Erlang 25 uses the %% syntax to document types just fine, and it renders in the edocs just fine.

Is it that edoc reads these comments directly from the file when generating, but it doesn’t make it into the documentation chunks used by rebar3_ex_doc? I’ve tried to look at the documentation chunk directly with code:get_doc/1 and I don’t see the documentation there.

%% @doc it works perfectly for me on OTP 27.

code

document view:

https://hexdocs.pm/ecron/ecron.html#add/7

rebar.config

Thanks for this example, but it doesn’t apply to my issue. To clarify, I’m having issues documenting the -type attribute, not the -spec attribute. So something like this:

-type type_name() :: string().
%% Documentation for the above type.

Sorry, I tried, but ‘type’ doesn’t work either.

Hi :slight_smile:

I maintain rebar3_ex_doc. I can not replicate your issue with the following, could you provide an example source code (I know you provided a snippet). Also, what versions exactly are you using for both OTP 25 and rebar3_ex_doc?

To note, rebar3_ex_doc is mostly a simple plugin, where edoc and ex_doc do the real work.

Below is an example I used to test :

-module(footran).

-type grunt_file() :: string().
%% The mess we're in.

-export_type([grunt_file/0]).

-export([the_mess_we_are_in/1]).

-spec the_mess_we_are_in(grunt_file()) -> ok.
the_mess_we_are_in(Str) ->
    io:put_chars(Str).

1 Like