-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: fix entity specs #2652
fix: fix entity specs #2652
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Is there really no built-in JS function to convert html entities? |
Unfortunately no. The reason given is because they are HTML entities not JavaScript entities. 🫤 There is an easy way to convert them if you have a DOM available but NodeJS doesn't have a DOM so it wouldn't always be available. And since they are automatically converted by the browser the broken tests don't mean anything is actually broken in marked, just that the output looks different. |
Any objections to merging this? |
That would be unfortunate. Perhaps we could add the most common ones to |
@@ -170,7 +170,7 @@ export class Renderer { | |||
if (href === null) { | |||
return text; | |||
} | |||
let out = '<a href="' + escape(href) + '"'; | |||
let out = '<a href="' + href + '"'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about when href
contains a '
or "
?
Do we have a test for that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the href runs through encodeURI
in the cleanURL
And this is covered by CommonMark 503 test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
## [4.2.3](v4.2.2...v4.2.3) (2022-11-20) ### Bug Fixes * fix entity specs ([#2652](#2652)) ([36a2b63](36a2b63)) * fix link reference definitions specs ([#2654](#2654)) ([b7eea95](b7eea95)) * fix marked.use with multiple args ([#2651](#2651)) ([73a7bf5](73a7bf5)) * fix multiline setext headings ([#2655](#2655)) ([4aee878](4aee878))
Marked version: 4.2.2
Description
Fix
Entity and numeric character references
specs #28 and #34.In order to fix the last 2
Entity and numeric character references
specs we would need to convert html entities to percent encoded with this json map: https://html.spec.whatwg.org/entities.json. This would increase the size of marked significantly (almost double 48k -> 84k) and provide very little benefit to the actual output.Contributor
Committer
In most cases, this should be a different person than the contributor.