Using monospace in docs

I’m trying to add an ascii diagram to a @moduledoc, but when I generate the docs using ex_docs's mix docs, the output doesn’t look well because of the non-monospace font it’s using.

Is there any way I can tell the docs to use a monospace font here?

      ┌──────┐
      │ User │
      └──────┘
          ◆
          │
      ┌──────────┐
      │ Settings │
      └──────────┘

Screen Shot 2021-06-04 at 16.49.17

You could use the :assets config option to provide your own CSS and use the :before_closing_head_tag to call that CSS into your docs.

See mix docs — ex_doc v0.24.2

Alternatively, as docs are rendered using markdown, you should be able to output a code block by indenting your diagram with four spaces.

2 Likes

Thanks, you definitely pointed me in the right direction. For anyone interested, I found this link very useful: Customize how your ExDoc documentation looks | by Takanori Ishikawa | Medium

2 Likes