Ex_docs some examples not showing

Hi

I’ve recently faced a problem with doc tests on html documents:

Here is my code and docs:

@doc """
Does something good!

## Examples
iex> Module.do_something
{:ok, 123}

iex> Module.do_something
:error
"""
def do_something() do
  ...
end

In the documents the output will be like:

Examples

iex> Module.do_something
iex> Module.do_something :error

As you can see the tuple in the first example is missing in the docs. Am i doing something wrong?

Hi, have you put four spaces before the doc tests? It looks like you haven’t, but it might have just been caused by copy/paste.

@doc """
Articulates the given frob.

## Examples

    iex> frob = %Frob{}
    iex> Articulator.articulate(frob)
    {:ok, %Frob{articulated: true}}

"""
def articulate(%Frob{}) do
  {:ok, %Frob{articulated: true}}
end

Until I changed my doctests to what you see above, weird things happened.

1 Like

Yes that was my problem. :slight_smile:

Thank you very much