Repository navigation
Conversation
|
@mmporong 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.
|
This branch was successfully deployed
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: 18.1.3 (master ba50aa9)
Markdown flavor: CommonMark
Description
Expectation
A hard line break inside an image description stays a line break in the alt text. commonmark.js 0.31.2 renders
andwithalt="foo\nbar", and marked already keeps a soft line break the same way (givesalt="foo\nbar").Result
marked gives
alt="foobar"for both hard break forms, including reference-style images, so the words run together in the alt text._TextRenderer.br()returns an empty string, and image alt text is rendered with the text renderer.Change
_TextRenderer.br()now returns'\n'. Image alt text is the only place marked's own parser uses the text renderer.marked.TextRendereris also exported, so a renderer built on it now gets a newline for a hard break instead of nothing.Demo (marked 18.1.3 and the CommonMark reference):
Tests: new spec
test/specs/new/image_alt_hard_break(renderExact: true; backslash, two spaces, and a reference-style image) fails on master and passes with this change. Withnode esbuild.config.js, the spec tests (1985) and unit tests (242) pass, andeslintandtsc --noEmitare clean on the change. I did not run the fullnpm test(types with attw, UMD/CJS checks, docs build).Contributor
Committer
In most cases, this should be a different person than the contributor.