Skip to content

Add a directive for previewing MyST + rST with tabs for Sphinx docs #25

@choldgraf

Description

@choldgraf

One challenge of us introducing MyST to the Sphinx world is that almost all of the documentation is written in rST, not MyST Markdown, and many folks will likely want to keep rST in their documentation rather than switch to MyST entirely.

For that group, it would be great if there were a way to display MyST syntax without requiring them to re-write their example usage.

So I wonder if we could use this tool to provide a directive like:

.. rst-myst-demo::
   .. admonition::
      My admonition!

That would effectively mimic the following behavior:

.. tabbed:: reStructuredText
   .. code-block:: rst
      .. admonition::
         My admonition `with a link <https://google.com>`_!

.. tabbed:: MyST Markdown
   .. code-block:: md
      ```{admonition}
      My admonition [with a link](https://google.com).
      ```

.. admonition::
   My admonition!

This way, people could take their pre-existing rST examples, and simply wrap them in .. rst-myst-demo:: and they'd get MyST generated for their examples as well.

An example of what this could look like in practice is @pradyunsg's excellent reference material for Furo here:

https://pradyunsg.me/furo/reference/admonitions/

where he shows "split" views of rST and MyST markdown for all of the directives.

(ideally, it would be possible to do this for MyST markdown -> rst as well, but I don't believe that functionality exists currently)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions