Skip to content

Strip markdown HTML comments within paragraph#1698

Open
tompng wants to merge 1 commit intoruby:masterfrom
tompng:markdown_comment
Open

Strip markdown HTML comments within paragraph#1698
tompng wants to merge 1 commit intoruby:masterfrom
tompng:markdown_comment

Conversation

@tompng
Copy link
Copy Markdown
Member

@tompng tompng commented May 6, 2026

Standalone HTML comments is converted to RDoc::Markup::Raw. However, HTML comments in a paragraph were not handled correctly.
Since RDoc paragraph can't contain Raw, inline HTML comments should be stripped. HTML comments in a paragraph "\n<!-- -->\n" will generate double newline "\n\n", so ToHtml also needs to handle this double newline.

Fix this markdown comment rendering

##
# :markup: markdown
# <!-- comment1 -->
# hello
# <!-- comment2 -->
# world

Before

<!-- comment1 -->
<p>hello &lt;!– comment2 –&gt; world</p>

After

<!-- comment1 -->
<p>hello world</p>

Standalone HTML comments is converted to RDoc::Markup::Raw.
However, HTML comments in a paragraph were not handled correctly.
Since RDoc paragraph can't contain Raw, inline HTML comments should be stripped.
HTML comments in a paragraph "\n<!-- -->\n" will generate double newline "\n\n", so ToHtml also needs to handle this double newline.
Copilot AI review requested due to automatic review settings May 6, 2026 18:13
@tompng tompng deployed to fork-preview-protection May 6, 2026 18:13 — with GitHub Actions Active
@matzbot
Copy link
Copy Markdown
Collaborator

matzbot commented May 6, 2026

🚀 Preview deployment available at: https://d3cb0ca4.rdoc-6cd.pages.dev (commit: 9037f7b)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants