mgaitan/sphinxcontrib-mermaid

Support `title` option in `mermaid` MyST directive

kdeldycke opened this issue · 1 comments

The mermaid documentation propose to use the title: option to add a title to the produced graph, in the form of:

---
title: Node
---
flowchart LR
    id

Now I'm trying to use this syntax to render a diagram in Sphinx with a MyST directive:

```{mermaid}
---
title: click_extra.platforms.NON_OVERLAPPING_GROUPS
---
sequenceDiagram
    participant Alice
    participant Bob
    Alice->John: Hello John, how are you?
```

Unfortunately the title: option is not recognized by the sphinxcontrib-mermaid extension and produce the following error:

$ poetry run sphinx-build -b html ./docs ./docs/html
Running Sphinx v5.3.0
loading pickled environment... done
myst v0.18.1: MdParserConfig(commonmark_only=False, gfm_only=False, enable_extensions=['colon_fence'], disable_syntax=[], all_links_external=False, url_schemes=('http', 'https', 'mailto', 'ftp'), ref_domains=None, highlight_code_blocks=True, number_code_blocks=[], title_to_header=False, heading_anchors=None, heading_slug_func=None, footnote_transition=True, words_per_minute=200, sub_delimiters=('{', '}'), linkify_fuzzy_links=True, dmath_allow_labels=True, dmath_allow_space=True, dmath_allow_digits=True, dmath_double_inline=False, update_mathjax=True, mathjax_classes='tex2jax_process|mathjax_process|math|output_area')
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 1 source files that are out of date
updating environment: 0 added, 1 changed, 0 removed
reading sources... [100%] platforms                                                                                                                                                                                
~/click-extra/docs/platforms.md:7: ERROR: Directive 'mermaid': Unknown option: title

---
title: click_extra.platforms.NON_OVERLAPPING_GROUPS
---
sequenceDiagram
    participant Alice
    participant Bob
    Alice->John: Hello John, how are you?
~/click-extra/docs/platforms.md:19: ERROR: Directive 'mermaid': Unknown option: title
(...)