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

reStructuredText (RST) renderer #310

Closed
jpmckinney opened this issue Feb 13, 2021 · 3 comments
Closed

reStructuredText (RST) renderer #310

jpmckinney opened this issue Feb 13, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@jpmckinney
Copy link
Contributor

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

Sphinx has a csv-table directive. I have CSVs with Markdown content. I subclassed that directive to rewrite the Markdown as RST (using commonmark). I'd like to be able to do the same with MyST.

Describe the solution you'd like

Perhaps a method like to_rst that matches the API of to_docutils, etc.

Describe alternatives you've considered

Right now I'm using commonmark, which has an RST renderer, e.g.:

import commonmark

commonmark.commonmark("Markdown **string**", "rst")

See code https://github.com/readthedocs/commonmark.py/blob/master/commonmark/render/rst.py

@jpmckinney jpmckinney added the enhancement New feature or request label Feb 13, 2021
@chrisjsewell
Copy link
Member

chrisjsewell commented Feb 15, 2021

Yeh its relatively simple to add a markdown-it-py render (see e.g. executablebooks/markdown-it-py#48, executablebooks/markdown-it-py#103 and https://github.com/executablebooks/mdformat/blob/915f2ef4350346065a729a257f3ac81c060a28b1/mdformat/renderer/__init__.py#L16)

For the csv-table directive though, I'm not quite sure if I understand your use case, since myst-parser will already parse the Markdown in the CSV? (it does not need to be rewritten as RST)

@jpmckinney
Copy link
Contributor Author

Hmm, you're right; I think maybe the behavior was different in recommonmark. I'll test if I still need this directive subclass.

@jpmckinney
Copy link
Contributor Author

I'll close this for now. I haven't had time to check recently.

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

2 participants