Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: {include} rST files in md? #204

Closed
rossbar opened this issue Aug 11, 2020 · 3 comments
Closed

Question: {include} rST files in md? #204

rossbar opened this issue Aug 11, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@rossbar
Copy link
Contributor

rossbar commented Aug 11, 2020

Is your feature request related to a problem? Please describe.

It would be nice if it were possible to include the parsed output from an .rst formatted file in a MyST markdown file via the {include} (or perhaps some other, new) directive.

Describe the solution you'd like

For example, let's say you have two files: hello.rst and world.md like so:

hello.rst:

.. note::
   Hello

world.md:

```{include} hello.rst
```
```{note}
World!
```

The desired output after running sphinx would be an html file containing two note boxes. Given that this feature crosses the boundary between parsing MyST files and building with sphinx, I'm not sure that this is the appropriate place to raise the issue... please LMK if there is a better place for it!

Describe alternatives you've considered

The simplest solution would be to convert the file (e.g. hello.rst in the example above) to myst syntax. There are some cases where this isn't feasible. For example, consider a contributing page in the documentation. One may want to have this included in, say, the sphinx documentation for a project as well as in the top level of the github repo. Since GitHub only supports parsing rst or gfm, you may have a situation where you want to {include} CONTRIBUTING.rst in the docs.

Of course, you can leave the file which includes the external file in .rst format, but then you have a mix of rst and md files in the documentation which may be confusing for new contributors.

Additional context

This question/feature request arose from the discussion in scikit-image/scikit-image#4863

Also possibly related to #163/#164

@chrisjsewell
Copy link
Member

Heya, yeh I was gonna say the solution here would likely be #164, but I'll bear this particular use case in mind.

Obviously, I would prefer if we could try to find "Markdown solutions". For example, admonitions (like note boxes) are not rendered very nicely at present in standard markdown renderers; well just today I've nearly finished a feature to improve that situation 😄 (#203) see: https://myst-parser--203.org.readthedocs.build/en/203/using/syntax.html#admonition-directives-special-syntax-optional

and there also a few more GFM ~compatible syntax features I am looking into adding https://github.com/executablebooks/markdown-it-py/issues/23

@chrisjsewell
Copy link
Member

Closed in v0.12.2 😄 see: https://myst-parser.readthedocs.io/en/latest/using/howto.html#include-rst-files-into-a-markdown-file

@mforbes
Copy link

mforbes commented Jul 20, 2021

Updated link: https://myst-parser.readthedocs.io/en/latest/sphinx/use.html?highlight=include#include-rst-files-into-a-markdown-file and spoiler:

```{eval-rst}
.. include:: snippets/include-rst.rst
```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants