executablebooks / rst-to-myst

Convert ReStructuredText to MyST Markdown
https://rst-to-myst.readthedocs.io
MIT License
64 stars 11 forks source link

Notify users in case output syntax requires `myst` extensions #15

Closed mbercx closed 3 years ago

mbercx commented 3 years ago

When converting to myst syntax that requires extensions, it would be good in case the user was made aware of these required extensions somehow.

The description below was my original post, which thought the conversion was buggy because I wasn't aware of the extension colon_fence.


Describe the bug

When converting e.g. a figure directive

.. _fig_intro_workchain_graph:
.. figure:: include/images/basics_workchain_graph.png
    :scale: 30
    :align: center

    Provenance Graph of a basic AiiDA WorkChain.

This gets converted into


(fig-intro-workchain-graph)=
:::{figure} include/images/basics_workchain_graph.png
:scale: 30
:align: center

Provenance Graph of a basic AiiDA WorkChain.

:::

Expected behavior

Doesn't myst-nb need backticks for the directives? I.e. if I convert this into

(fig-intro-workchain-graph)=

```{figure} include/images/basics_workchain_graph.png
:scale: 30
:align: center

Provenance Graph of a basic AiiDA WorkChain.
```#

This works fine for me.

Similar issues arise for note and important directives (and possibly others that are not in the file I'm converting).

Environment

mbercx commented 3 years ago

Title should be:

Some directives convert into :::{<directive>}, not ```{<directive>}

But if I copy paste this into the Title and save it, it doesn't work. 🤨

This is seriously triggering my OCD. 😅

chrisjsewell commented 3 years ago

See https://myst-parser.readthedocs.io/en/latest/using/syntax-optional.html, you can add colon_fence to the myst extensions to also allow for colons. (But yeh I intend to make it clearer with this tool when it is outputting syntax that requires extensions)

mbercx commented 3 years ago

Updated title and OP, can't change label unfortunately 😭