executablebooks / MyST-Parser

An extended commonmark compliant parser, with bridges to docutils/sphinx
https://myst-parser.readthedocs.io
MIT License
730 stars 192 forks source link

`parsed-literal` does not preserve code-highlighting #854

Open LecrisUT opened 7 months ago

LecrisUT commented 7 months ago

I am not sure if this is a bug or documentation issue. Basically I saw CMake's documentation that uses parsed-literal, and I wanted to port that design to my myst documentation. But I cannot get the code-highlighting to detect the language correctly. I don't know if there is a specific that should be enabled for that or is this specific to RST?

chrisjsewell commented 7 months ago

But I cannot get the code-highlighting to detect the language correctly

Heya, I'm a bit confused what you mean by this? parsed-literal will parse the containing block as MyST, it is not for code highlighting: https://docutils.sourceforge.io/docs/ref/rst/directives.html#parsed-literal-block

LecrisUT commented 7 months ago

From what I've read on forums it is only supposed to parse its known markups like the links. For myst, it does do that, but steadily then the code highlighting is lost.

Alternatively would it be possible to code something to markup only markdown links (reference style links or autolinks might be tricky) and pass everything else to either code-highlight parser?