Skip to content

fix: named code block escape - #152

Open
claustra01 wants to merge 1 commit into
mainfrom
fix/codeblock-filename
Open

fix: named code block escape#152
claustra01 wants to merge 1 commit into
mainfrom
fix/codeblock-filename

Conversation

@claustra01

Copy link
Copy Markdown
Member

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR replaces the markdown-it-named-code-blocks dependency with a small in-repo compatible renderer override that supports “language:filename” fenced code blocks while safely escaping the filename before rendering HTML.

Changes:

  • Added a local namedCodeBlocks markdown-it plugin that wraps fenced code blocks with filename markup and escapes filenames via md.utils.escapeHtml.
  • Updated the markdown-it setup to use the new local plugin implementation.
  • Removed markdown-it-named-code-blocks from package.json and cleaned up package-lock.json accordingly.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
plugins/namedcodeblocks.js Introduces the local replacement plugin; strips filename from token.info, renders filename safely, and wraps the rendered fence output.
plugins/markdownit.js Switches the markdown-it plugin import to the new local implementation and continues registering it via md.use(...).
package.json Removes the markdown-it-named-code-blocks dependency.
package-lock.json Removes markdown-it-named-code-blocks and its transitive dependencies from the lockfile.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@claustra01
claustra01 requested a review from simesaba80 August 6, 2026 15:06
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