Skip to content

Commit

Permalink
Update docs and tests for markdown support
Browse files Browse the repository at this point in the history
  • Loading branch information
mgaitan committed Jul 17, 2021
1 parent bfb042a commit 4613254
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 23 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
---------

0.7.1 (July 17, 2021)
+++++++++++++++++++++

- Update docs and tests for markdown support


0.7 (May 31, 2021)
++++++++++++++++++++++++++

Expand Down
10 changes: 5 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,14 @@ Markdown support
----------------

You can include Mermaid diagrams in your Markdown documents in Sphinx.
You just need to setup the `markdown support in Sphinx <https://www.sphinx-doc.org/en/master/usage/markdown.html>`_
with the `AutoStructify component <https://recommonmark.readthedocs.io/en/latest/auto_structify.html#autostructify-component>`_ enabled. See a `minimal configuration in the tests <https://github.com/mgaitan/sphinxcontrib-mermaid/blob/master/tests/roots/test-markdown/conf.py>`_
You just need to setup the `markdown support in Sphinx <https://www.sphinx-doc.org/en/master/usage/markdown.html>`_ via
`myst-parser <https://myst-parser.readthedocs.io/>`_
. See a `minimal configuration from the tests <https://github.com/mgaitan/sphinxcontrib-mermaid/blob/master/tests/roots/test-markdown/conf.py>`_

Then in your `.md` documents include a code block as in reStructuredText (note the two semicolons)::
Then in your `.md` documents include a code block as in reStructuredTexts::


```mermaid::
```{mermaid}

sequenceDiagram
participant Alice
Expand All @@ -191,4 +192,3 @@ Then in your `.md` documents include a code block as in reStructuredText (note t
```


This works via the `AutoStructify's eval_rst <https://recommonmark.readthedocs.io/en/latest/auto_structify.html#embed-restructuredtext>`_ feature.
4 changes: 2 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
recommonmark==0.7.1
Sphinx>=3.2.1
Sphinx>=3.2.1
myst-parser>=0.15.1
14 changes: 4 additions & 10 deletions tests/roots/test-markdown/conf.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
from recommonmark.parser import CommonMarkParser
from recommonmark.transform import AutoStructify

extensions = ['recommonmark', 'sphinxcontrib.mermaid']
extensions = ['sphinxcontrib.mermaid', 'myst_parser']
exclude_patterns = ['_build']

source_parsers = {
'.md': CommonMarkParser
}

def setup(app):
app.add_transform(AutoStructify)
source_suffix = {
'.md': 'markdown'
}
4 changes: 2 additions & 2 deletions tests/roots/test-markdown/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hi from markdown
# Hi from Markdown!

```mermaid::
```{mermaid}
sequenceDiagram
participant Alice
Expand Down
8 changes: 4 additions & 4 deletions tests/test_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def test_html_raw_from_markdown(index):
assert "<script>mermaid.initialize({startOnLoad:true});</script>" in index
assert """
<div class="mermaid">
sequenceDiagram
participant Alice
participant Bob
Alice-&gt;John: Hello John, how are you?
sequenceDiagram
participant Alice
participant Bob
Alice-&gt;John: Hello John, how are you?
</div>""" in index

0 comments on commit 4613254

Please sign in to comment.