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

[myst] #376

Closed
farabolaza opened this issue Feb 5, 2021 · 3 comments
Closed

[myst] #376

farabolaza opened this issue Feb 5, 2021 · 3 comments

Comments

@farabolaza
Copy link

farabolaza commented Feb 5, 2021

I'm not a programmer, so maybe chances are that my issue is not really a problem of the myst plugin.

All roles and directives that have a rst-like syntax are no parsed right by myst plugin, only the ones that are mardown-like.

In myst.py (line 66) we see

output = myst_parser.main.to_html(new_data)

I tried to use the myst API to reproduce the behavior of to_hml by itself and it produces the same not valid html output.

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

It could be something related to how myst workflow is internally wired, which seems to rely on sphinx and ultimately docutils to produce the html (i tried every admonition including the ones that are identical upon translation, as {error} giving same results.

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

Finally, i set up both sphinx and a jupyterbook mock sessions and fed them the same .md document giving valid html output wich was rendered as expected.

Any help would be great.

@Kwpolska
Copy link
Member

Kwpolska commented Feb 7, 2021

We’re using the most basic myst API in the plugin, as documented. Considering you can also easily reproduce this outside of Nikola, it’s a myst issue. Please report a bug to the myst project, and without the Nikola context (run to_html directly, with your REPL sample).

@Kwpolska Kwpolska closed this as completed Feb 7, 2021
@farabolaza
Copy link
Author

farabolaza commented Feb 14, 2021

Hi, i asked to the myst project, and here it's their answer: So, as i suspected, sphinx is needed to get the proper output. At least to me, it means that using myst plugin in nikola has no sense because it won't parse all its features which somehow i can get from restructured text. Of course that myst its a nice mix of both worlds which I would prefer to have access to from nikolla.

Thanks for your support, nikola its a great project!

@Kwpolska
Copy link
Member

Maybe the plugin could be fixed to work without sphinx (by going through docutils.Document?) — patches for this are welcome. (I’d suggest just using reST though.)

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

No branches or pull requests

2 participants