Skip to content

Commit

Permalink
Use myst-parser mapping of fences as directives to have interoperable
Browse files Browse the repository at this point in the history
rendering between Sphinx and GitHub.

Refs:
mgaitan/sphinxcontrib-mermaid#108
mgaitan/sphinxcontrib-mermaid#99
  • Loading branch information
kdeldycke committed Mar 28, 2023
1 parent 2a3e09b commit b972cf5
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 18 deletions.
17 changes: 7 additions & 10 deletions click_extra/docs_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,13 @@ def generate_platforms_graph(
# Wrap the Mermaid code into a MyST block.
return "\n".join(
(
"```{mermaid}",
# XXX Titles are not supported by sphinxcontrib-mermaid yet:
# https://github.com/mgaitan/sphinxcontrib-mermaid/issues/108
#
# "---",
# (
# f"title: click_extra.platforms.{graph_id} - {description}"
# f" (Click Extra v{__version__})"
# ),
# "---",
# Use attributes blocks extension to add a title.
(
'{caption="'
f"`click_extra.platforms.{graph_id}` - {description}"
'"}'
),
"```mermaid",
"flowchart",
indent("\n".join(sorted(subgraphs)), INDENT),
"```",
Expand Down
2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@
]

myst_enable_extensions = [
"attrs_block",
"colon_fence",
]
myst_fence_as_directive = ["mermaid"]

master_doc = "index"

Expand Down
2 changes: 1 addition & 1 deletion docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ FYI, here is a graph of Python package dependencies:
```{eval-rst}
.. mermaid:: images/dependencies.mmd
:align: center
```
```
6 changes: 4 additions & 2 deletions docs/platforms.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ All platforms are grouped in sets of non-overlaping families:

<!-- NON_OVERLAPPING_GROUPS-graph-start -->

```{mermaid}
{caption="`click_extra.platforms.NON_OVERLAPPING_GROUPS` - Non-overlapping groups."}
```mermaid
flowchart
subgraph <code>click_extra.platforms.ALL_LINUX</code><br/><em>All Linux</em>
all_linux_linux(<code>linux</code><br/><em>Linux</em>)
Expand Down Expand Up @@ -45,7 +46,8 @@ Other groups are available for convenience, but these overlaps:

<!-- EXTRA_GROUPS-graph-start -->

```{mermaid}
{caption="`click_extra.platforms.EXTRA_GROUPS` - Overlapping groups, defined for convenience."}
```mermaid
flowchart
subgraph <code>click_extra.platforms.ALL_PLATFORMS</code><br/><em>All platforms</em>
all_platforms_aix(<code>aix</code><br/><em>AIX</em>)
Expand Down
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ xmltodict = ">=0.12,<0.14"
bump2version = "^1.0.1"
coverage = { extras = ["toml"], version = "^7.2" }
mypy = "^1.1"
myst-parser = "^0.19.1"
myst-parser = "^1.0.0"
pytest = "^7.2.2"
# More pytest plugins at: https://docs.pytest.org/en/latest/reference/plugin_list.html
pytest-cases = "^3.6.14"
Expand Down

0 comments on commit b972cf5

Please sign in to comment.