Skip to content

Commit c7cf59a

Browse files
authored
fix html comment clearing (#702)
1 parent 200cc0f commit c7cf59a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/doc_builder/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,8 +548,8 @@ def strip_remaining_html(content: str) -> str:
548548
Strip remaining HTML tags while preserving markdown structure.
549549
Handles tags like <Tip>, <ExampleCodeBlock>, etc.
550550
"""
551-
# Remove HTML comments
552-
content = re.sub(r"<!--.*?-->", "", content, flags=re.DOTALL)
551+
# Remove HTML comments, but preserve special flags like <!-- WRAP CODE BLOCKS --> and <!-- STRETCH TABLES -->
552+
content = re.sub(r"<!--(?!\s*(WRAP CODE BLOCKS|STRETCH TABLES)\s*-->).*?-->", "", content, flags=re.DOTALL)
553553

554554
# Remove common component tags while preserving their content
555555
# (Tip, TipEnd, ExampleCodeBlock, hfoptions, hfoption, etc.)

0 commit comments

Comments
 (0)