markdown: Parse included blocks in a new parser state.

This fixes inclusion of a multi-paragraph file into a list item.

Followup to commit dc33a0ae67 (#22315).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit 869fe60689)
This commit is contained in:
Anders Kaseorg
2022-06-27 14:03:22 -07:00
committed by Tim Abbott
parent e61ffc5bd7
commit 3f0919cc65

View File

@@ -47,7 +47,9 @@ class IncludeBlockProcessor(BlockProcessor):
return "\n".join(lines)
def run(self, parent: Element, blocks: List[str]) -> None:
blocks[:1] = self.RE.sub(self.expand_include, blocks[0]).split("\n\n")
self.parser.state.set("include")
self.parser.parseChunk(parent, self.RE.sub(self.expand_include, blocks.pop(0)))
self.parser.state.reset()
def makeExtension(base_path: str) -> IncludeExtension: