How to add example after a list in documentation?

I’m trying to create a documentation for my function, like this:

{-| some description

  - some
  - list

    Basics.ceiling 123.45
        |> Basics.toFloat
        --> 124.0
-}
someFunction : ...

The problem here is that elm-format will either mangle the list before the example, or will change 4-space-indented code to using backticks which doesn’t work with elm-verify-examples (issue)

Is there a way to make this work?

For me, elm-format formats like this:

{-| some description

  - some

  - list

    Basics.ceiling 123.45
    |> Basics.toFloat
    --> 124.0

-}

Is that a problem?

Maybe you can add a <!-- --> comment between the list and the code.

That breaks single list into several lists, and also makes the code-block not render as code-block but as normal text under last list item.

As for <!-- -->, that is then included as text in output since Elm doesn’t support HTML here.

For now I’m adding ## Examples between list and example as I havn’t found any better idea.

&nbsp; makes an empty paragraph:

{-| some description
 
  - some
  - list
 
&nbsp;
 
    Basics.ceiling 123.45
    |> Basics.toFloat
    --> 124.0
 
-}

Note sure if this is a good idea though.

You can also use some simple text:

{-| some description
 
  - some
  - list
 
For example:
 
    Basics.ceiling 123.45
    |> Basics.toFloat
    --> 124.0
 
-}

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.