getnikola / plugins

Extra plugins for Nikola
https://plugins.getnikola.com/
MIT License
57 stars 93 forks source link

[myst] #376

Closed farabolaza closed 3 years ago

farabolaza commented 3 years ago

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)

Here\'s some text

\n
    \n
  1. a list
  2. \n
\n
\n

a quote

\n
\n

{ref}[target]

\n
name\n    definition\n
\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 ````
This is my note\n
\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 commented 3 years ago

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

farabolaza commented 3 years ago

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 commented 3 years ago

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