Skip to content

fix: detect raw end tags and comments inside code blocks - #45

Open
Aaqibhafeezkhan wants to merge 1 commit into
malav2110:mainfrom
Aaqibhafeezkhan:fix/issue-40-code-block-raw-markup
Open

Aaqibhafeezkhan wants to merge 1 commit into
malav2110:mainfrom
Aaqibhafeezkhan:fix/issue-40-code-block-raw-markup

Conversation

@Aaqibhafeezkhan

Copy link
Copy Markdown
Contributor

Summary

Fixes the code-escaped validation check so it catches raw HTML comments and malformed closing tags inside <pre> and <code> blocks.

Previously, the validator detected unexpected HTML elements but could miss raw closing tags and HTML comments.

Changes

  • Detect HTML comments inside code blocks.
  • Capture parse5 parsing errors and identify malformed closing tags within code-block source ranges.
  • Preserve the existing allowed .del, .add, and .hi spans.
  • Update validation documentation.
  • Add regression fixtures covering raw comments, raw closing tags, and premature </pre> termination with injected markup.

Testing

  • Added regression fixtures under tests/validate-output/fail/code-escaped/.

Closes #40

@Aaqibhafeezkhan Aaqibhafeezkhan left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-review:

  • Extended code-escaped to detect unexpected HTML comments.
  • Added detection for malformed closing tags using parse5 parser errors and source offsets.
  • Preserved the existing allowed syntax-highlight spans.
  • Added regression fixtures for the reported edge cases.
  • Updated validation documentation.
  • Verify the generated validator bundle is updated.
  • Run the build, type checks, and complete test suite.

@Aaqibhafeezkhan
Aaqibhafeezkhan force-pushed the fix/issue-40-code-block-raw-markup branch from bd94cb0 to b876470 Compare November 16, 2026 06:01
@malav2110

Copy link
Copy Markdown
Owner

Hey @Aaqibhafeezkhan , Thank you for raising the PR. I will review and get back to you.

@Aaqibhafeezkhan
Aaqibhafeezkhan force-pushed the fix/issue-40-code-block-raw-markup branch from b876470 to d89862e Compare November 16, 2026 23:27
Signed-off-by: Aaqibhafeez Khan <githubaaqibhafeezkhan@gmail.com>
@Aaqibhafeezkhan
Aaqibhafeezkhan force-pushed the fix/issue-40-code-block-raw-markup branch from d89862e to 4101b69 Compare November 20, 2026 00:34

This branch has not been deployed

No deployments
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.

Catch raw end tags and comments inside code blocks

2 participants