Skip to content

fix: render nested image alt formatting as plain text - #4131

Open
Kesavamoorthig06 wants to merge 2 commits into
markedjs:masterfrom
Kesavamoorthig06:fix-nested-image-alt
Open

Kesavamoorthig06 wants to merge 2 commits into
markedjs:masterfrom
Kesavamoorthig06:fix-nested-image-alt

Conversation

@Kesavamoorthig06

Copy link
Copy Markdown

Marked version: 18.1.0
Markdown flavor: CommonMark / GFM

Description

Nested formatting in image descriptions leaves Markdown in the alt text.

![**a `b`**](image.png)

Expected: alt="a b". Actual: alt="a `b`".

Walk the child tokens in the text renderer, as the normal renderer does. Code spans keep their literal contents. This matches CommonMark's plain-text image description behavior and follows #3668.

Added regressions for nested emphasis, code, deletion, links and images. npm test passes.

Contributor

  • Tests exist to ensure functionality and minimize regression.

@vercel

vercel Bot commented Oct 11, 2026

Copy link
Copy Markdown

@Kesavamoorthig06 is attempting to deploy a commit to the MarkedJS Team on Vercel.

A member of the Team first needs to authorize it.

Comment thread test/unit/marked.test.js

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

parse tests should be in test/specs/new add a .md file with the markdown and a .html file with the output html

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks, moved the parse tests to a .md/.html pair in test/specs/new and removed the unit tests. npm test passes.

@vercel

vercel Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
marked-website Ready Ready Preview Oct 12, 2026 4:54pm UTC

Request Review

@UziTech UziTech left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice catch! 💯

This branch was successfully deployed

1 active deployment
Preview — e9245d91 Deployed Oct 12, 2026 by vercel[bot]
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