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

Add an eval_rst directive #164

Closed
choldgraf opened this issue Jun 6, 2020 · 3 comments · Fixed by #226
Closed

Add an eval_rst directive #164

choldgraf opened this issue Jun 6, 2020 · 3 comments · Fixed by #226
Labels
enhancement New feature or request

Comments

@choldgraf
Copy link
Member

In #163 we identified that there may be circumstances where the author still needs to write rST with MyST. For example, if a person uses autodoc and wants their documentation written in MyST, but has docstrings written in rST.

In that case, we could include a directive like recommonmark's eval_rst that will call the rST parser on its content.

Another possible approach (maybe this is unrealistic?) is to allow for a flag in all directives used by MyST-parser that could tell the directive to parse the content with the rST parser instead of the MyST parser.

@choldgraf choldgraf added the enhancement New feature or request label Jun 6, 2020
@chrisjsewell
Copy link
Member

Another possible approach (maybe this is unrealistic?) is to allow for a flag in all directives used by MyST-parser that could tell the directive to parse the content with the rST parser instead of the MyST parser.

From here #163 (comment), it looks like sphinx does some weird stuff with the auto directives, actually rewriting the directive in rST format before parsing. In this case that approach would not work.

@choldgraf
Copy link
Member Author

Just a note that it looks like this is where recommonmark does this: https://github.com/readthedocs/recommonmark/blob/c4d575bd7bd5dd992cc3e2bed9dce625f4622a4d/recommonmark/transform.py#L246

It looks like they pass the contents to the RST state parser, which I think we have access to in MyST? We're using a Markdown "mock" parser, so hopefully the rST parser is available as well

@asmeurer
Copy link
Contributor

I was thinking, if it isn't hard, it might be useful to also provide the inverse directive, like .. eval_markdown:: for RST. That way things that currently have to be written in RST like #163 can still include Markdown segments.

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

Successfully merging a pull request may close this issue.

3 participants