getnikola / plugins

Extra plugins for Nikola

Home Page:https://plugins.getnikola.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[myst]

farabolaza opened this issue · comments

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.

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).

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!

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.)