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

to_html() output #307

Closed
farabolaza opened this issue Feb 8, 2021 · 7 comments
Closed

to_html() output #307

farabolaza opened this issue Feb 8, 2021 · 7 comments
Labels
documentation Improvements or additions to documentation

Comments

@farabolaza
Copy link

The html output produced by to_html() doesn't seem to fully parse any rst-like features of myst, like roles and directives.

I don't know if it's intended to behave this way.

To Reproduce

for instance

from myst_parser.main import to_html

test = ("""
Here's some *text*

1. a list

> a quote

{ref}`target`

```{glossary} my gloassary
name
    definition
```
"""
)


to_html(test)

<p>Here\'s some <em>text</em></p>\n<ol>\n<li>a list</li>\n</ol>\n<blockquote>\n<p>a quote
</p>\n</blockquote>\n<p>
<code class="sphinx-role">{ref}[target]</code>
</p>\n<pre><code class="language-{glossary}">name\n    definition\n</code></pre>\n

another input

t=("""
```{admonition} This is my admonition
This is my note
```
""")

to_html(t)

output

<pre><code class="language-{admonition}">This is my note\n</code></pre>\n

Environment

  • Python Version [e.g. 3.7.1]: 3.8.5
  • Package version (myst parser): 0.13.3
  • Operating System: Windows
@farabolaza farabolaza added the bug Something isn't working label Feb 8, 2021
@welcome
Copy link

welcome bot commented Feb 8, 2021

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.

If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).

Welcome to the EBP community! 🎉

@chrisjsewell
Copy link
Member

I don't know if it's intended to behave this way.

Heya, yes it is; you have to use sphinx to fully parse to HTML

@chrisjsewell chrisjsewell added documentation Improvements or additions to documentation and removed bug Something isn't working labels Feb 14, 2021
@chrisjsewell
Copy link
Member

This function is explained in https://myst-parser.readthedocs.io/en/latest/using/use_api.html

@farabolaza
Copy link
Author

Thanks for you answer, i read the api doc before posting here, but it wasn't really clear (at least to me, i'm not a programmer) that using sphinx was mandatory to get a fully parsed html output.

thanks again

@chrisjsewell
Copy link
Member

yes thanks, as you see I've changed the label to documentation to perhaps make this more clear

@choldgraf
Copy link
Member

Note that there may be some directives that we could natively parse and render one day (eg note directives) but it's unclear what would be the process to choose these directives. I think it's something to think about and explore though. If myst is popular enough, people will want to use it without the requirement for sphinx

@chrisjsewell
Copy link
Member

Heya, I'm going to close this, since I updated the documentation and docstrings in #426

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants