-
Notifications
You must be signed in to change notification settings - Fork 196
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
Add an eval-myst
directive
#388
Comments
I was able to use Since README's are rendered in the more conservative GitHub (vanilla docutil AFAIK) and PyPI (same?), I used
include root level ```{include} ../README.md
-``` < remove the -
versions used:
|
pandoc 2.14, prettier 2.3.1, myst-parser 0.15.0 executablebooks/MyST-Parser#388 (comment) pandoc --from rst --to gfm README.rst --markdown-headings=atx | \ sed s/"<"/"\("/g | sed s/">"/"\)"/g | \ sed s/"- "/"- "/g > tmp; mv tmp README.md prettier --parser=markdown -w README.md Inside of docs/index.md: ```{include} ../README.md ``` See also: executablebooks/MyST-Parser#388 (comment)
pandoc 2.14, prettier 2.3.1, myst-parser 0.15.0 executablebooks/MyST-Parser#388 (comment) pandoc --from rst --to gfm README.rst --markdown-headings=atx | \ sed s/"<"/"\("/g | sed s/">"/"\)"/g | \ sed s/"- "/"- "/g > tmp; mv tmp README.md prettier --parser=markdown -w README.md Inside of docs/index.md: ```{include} ../README.md ```
pandoc 2.14, prettier 2.3.1, myst-parser 0.15.0 executablebooks/MyST-Parser#388 (comment) pandoc --from rst --to gfm README.rst --markdown-headings=atx | \ sed s/"<"/"\("/g | sed s/">"/"\)"/g | \ sed s/"- "/"- "/g > tmp; mv tmp README.md prettier --parser=markdown -w README.md Inside of docs/index.md: ```{include} ../README.md ```
My, naturally biased, opinion would be; why, what's the point? Before, Markdown was limited compared to RST, so I could see the use case. Suffice to see, obviously I'm happy for someone else to give it a go, but I doubt I will
@tony as mentioned, rst-to-myst can already do this, no need for pandoc 😉, then also in executablebooks/rst-to-myst#18 I am hopefully making the Markdown output with https://mdformat.readthedocs.io, so no need for prettier 😬 |
FWIW, I landed here because I need Markdown to handle nesting (e.g. bold links), but RST has rich tables (e.g. bulleted list in a multiline cell). Everything is in Markdown for me already, but I needed an RST table and hit #391 when using |
I used a mixture of I needed to use pandoc and manual editing for corner cases. gave me tables, rst-to-myst would render those in
Interesting! Look forward to trying this out. In the meantime I'm using format_markdown:
prettier --parser=markdown -w *.md docs/*.md docs/**/*.md CHANGES |
Obviously here I would rather spend the time to fix the issue, than introduce an eval-myst
Good to hear 😄 I was just trying to "finalise" it, then promote it more in the docs here
This should only be the case for RST tables that are not "compliant" with Markdown tables, e.g. ones with cells spanning multiple columns/rows, otherwise they are converted. If you could provide an example of a table that you think should have been converted but was not, that would be helpful thanks.
yep that makes sense and can be added 👍 |
Note https://rst-to-myst.readthedocs.io/ is now out of alpha, including things like |
With docutils>=0.17 you can now do: .. include::
:parser: myst_parser.docutils_
.. include::
:parser: myst_parser.sphinx_ Although, I want to stress I don't consider this "officially" supported in myst-parser, since it is not an intended use case and completely untested. |
maintainer note: you can use https://rst-to-myst.readthedocs.io/ to convert one or more files from RST files -> MyST
I was just looking through the Sphinx issues, and saw that one of the top-rated issues included asking how to include a markdown file in an rST file.
In the myst-parser, to accomplish the opposite, we suggest users use
eval-rst
to include rST files in their markdown files (https://myst-parser.readthedocs.io/en/latest/using/howto.html#include-rst-files-into-a-markdown-file).So they can do:
So perhaps it would also be useful if MyST Parser defined an
eval-myst
directive that could be used withinrST
documents, and could do things like:The text was updated successfully, but these errors were encountered: