Skip to content

Commit

Permalink
Adjust some comments for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
facelessuser committed Jan 24, 2025
1 parent c7f59c9 commit 6ef7de4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .spell-dict
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ plugins
configs
pre
formatters

unflattened
dedented
Setext
unindented
Expand Down
8 changes: 7 additions & 1 deletion markdown/extensions/md_in_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,14 @@ def handle_endtag(self, tag):
current.text = f'{text}\n{self.md.htmlStash.store(child)}{tail}'
last.append(child)
else:
# Non-Markdown HTML will not be recursively parsed for Markdown,
# so we can just remove markers and leave them unflattened.
# Additionally, we don't need to append to our list for further
# processing.
child.attrib.pop('markdown')
[c.attrib.pop('markdown', None) for c in child.iter()]
current.text = f'{text}\n{self.md.htmlStash.store(child)}{tail}'
# Target the child elements that have been expanded.
current = last.pop(0) if last else None

self.cleandoc.append(self.md.htmlStash.store(element))
Expand Down Expand Up @@ -322,8 +327,9 @@ def parse_element_content(self, element: etree.Element) -> None:
el = self.parser.md.htmlStash.rawHtmlBlocks[index]
end = m.start()

# Cut out the placeholder and and insert the processed element back in.
if isinstance(el, etree.Element):
# Replace the placeholder with the element and process it.
# Content after the placeholder should be attached to the tail.
if child is None:
element.text = block[start:end]
else:
Expand Down

0 comments on commit 6ef7de4

Please sign in to comment.