fix(markdown): Setext heading support (#2359)

Signed-off-by: Matvei Smirnov <vdalekesmirnov@gmail.com>
Co-authored-by: Matvei Smirnov <matvei.smirnov@vkteam.ru>
This commit is contained in:
Matvei Smirnov
2025-10-03 11:32:53 +03:00
committed by GitHub
parent 246de77d8c
commit ee73ffae15
3 changed files with 22 additions and 1 deletions

View File

@@ -249,7 +249,10 @@ class MarkdownDocumentBackend(DeclarativeDocumentBackend):
# Iterates over all elements in the AST
# Check for different element types and process relevant details
if isinstance(element, marko.block.Heading) and len(element.children) > 0:
if (
isinstance(element, marko.block.Heading)
or isinstance(element, marko.block.SetextHeading)
) and len(element.children) > 0:
self._close_table(doc)
_log.debug(
f" - Heading level {element.level}, content: {element.children[0].children}" # type: ignore

View File

@@ -16,6 +16,14 @@ Heading:
Empty heading:
Setext heading level 1:
# my setext heading level 1
Setext heading level 2:
## my setext heading level 2
Indented code block:
```

View File

@@ -22,6 +22,16 @@ Empty heading:
#
Setext heading level 1:
my setext heading level 1
=========================
Setext heading level 2:
my setext heading level 2
-------------------------
Indented code block:
print("Hi!")