executablebooks / MyST-Parser

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

nested_parse is broken for block content #967

Open flying-sheep opened 2 months ago

flying-sheep commented 2 months ago

This doesn’t work:

https://github.com/executablebooks/MyST-Parser/blob/1038800fc411296369604a03756bec6945c6d4d8/myst_parser/mocking.py#L176

nested_render_text doesn’t seem to be able to handle block content, so if you run the following directive on a document that contains sections, several bugs happen:

  1. it appends nodes while running
  2. it doesn’t return all the nodes in the included fragment
  3. it therefore messes up the order in which things are displayed.
  4. it doesn’t respect the section hierarchy.

Reproducer

(Of course I don’t just want to re-implement the include directive, my actual code includes all files in a directory)

Output:

[!WARNING] index.md.rst:4: WARNING: Non-consecutive header level increase; H1 to H3 [myst.header]

Index

Included

Hi!

inc.md

Expected:

(no warning)

Index

inc.md

Included

Hi!

flying-sheep commented 2 months ago

@cclauss I think you replied to the wrong thread. My comment markdown is perfectly formatted and no backtick is out of place.

Is this similar to: #401

not even slightly. Can you please stop spamming this thread with irrelevant stuff?

From how completely unrelated everything you wrote is to the issue at hand, you’re either a bot or extremely sleep deprived.