bug: fix links with square brackets in inline code break wrapping italics#3785
Merged
UziTech merged 2 commits intomarkedjs:masterfrom Oct 7, 2025
Merged
Conversation
|
@DarkMatter-999 is attempting to deploy a commit to the MarkedJS Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
github-actions bot
pushed a commit
that referenced
this pull request
Oct 7, 2025
# [16.4.0](v16.3.0...v16.4.0) (2025-10-07) ### Bug Fixes * Fix backtick and code rendering in links ([#3783](#3783)) ([302ee59](302ee59)) * fix links with square brackets in inline code break wrapping italics ([#3785](#3785)) ([e3c0d3e](e3c0d3e)) * Make `www` case-sensitive when detecting link starts ([#3770](#3770)) ([626d961](626d961)) ### Features * Add async provideParser provideLexer ([#3756](#3756)) ([09577e5](09577e5))
1 task
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Marked version: 16.3.0 / master
Markdown flavor: CommonMark
Description
_#3774Expectation
The following Markdown:
_[a[b]c](http://example.com/_/path)_to be parsed into an emphasized link whose text is a codespan. In HTML this should be:
<p><em><a href="http://example.com/_/path"><code>a[b]c</code></a></em></p>Result
Before the change Marked produced a broken output where the emphasis was split and the link text/URL were parsed separately. The produced HTML looked like:
<p><em>[<code>a[b]c</code>](http://example.com/</em>/path)_</p>What was attempted
Updated the em/strong masking pattern so link text that contains a codespan is treated as a single block to be skipped by the em/strong tokenizer.
Changed the
blockSkipregex inmarked/src/rules.tsso bracketed link text may include backtick codespans (allowing patterns like[`a[b]c`]inside[]) and thus be masked as a unit for em parsing.Added spec tests:
test/specs/new/em_link_brackets.mdtest/specs/new/em_link_brackets.htmlWith that change, the inline tokenizer no longer sees the
_delimiter split across the link and URL, so the emphasis wrapping the link is preserved and the output matches the expectation.Contributor