Search code examples
markdownpython-sphinxmyst

Sphinx admonitions not rendering properly


I am writing documentation using Sphinx and would like to include admonitions. An example shown is shown here for the Book theme: https://sphinx-book-theme.readthedocs.io/en/stable/reference/kitchen-sink/paragraph-markup.html#admonitions

However, when including admonitions in my own documentation, they simply render as text:

:::{seealso} See Add a link to your repository for more information. :::

Rather than a styled box:

enter image description here

What could be going wrong? I have enabled the myst_parser extension. I tried with other themes, which have slightly different admonition syntax, but am having the same problem.


Solution

  • You have two options.

    1. Don't use colons (:) for fences. Use backticks.
    ```{seealso}
    See Add a link to your repository for more information.
    ```
    
    1. Enable colons in code fences.

    By adding "colon_fence" to myst_enable_extensions (in the sphinx conf.py configuration file), you can also use ::: delimiters to denote code fences, instead of ```.