Skip to content

Commit

Permalink
fix: fix entity specs (#2652)
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed Nov 20, 2022
1 parent 57a2031 commit 36a2b63
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/Renderer.js
Expand Up @@ -32,7 +32,7 @@ export class Renderer {

return '<pre><code class="'
+ this.options.langPrefix
+ escape(lang, true)
+ escape(lang)
+ '">'
+ (escaped ? code : escape(code, true))
+ '</code></pre>\n';
Expand Down Expand Up @@ -170,7 +170,7 @@ export class Renderer {
if (href === null) {
return text;
}
let out = '<a href="' + escape(href) + '"';
let out = '<a href="' + href + '"';
if (title) {
out += ' title="' + title + '"';
}
Expand Down
6 changes: 3 additions & 3 deletions src/helpers.js
Expand Up @@ -2,9 +2,9 @@
* Helpers
*/
const escapeTest = /[&<>"']/;
const escapeReplace = /[&<>"']/g;
const escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/;
const escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g;
const escapeReplace = new RegExp(escapeTest.source, 'g');
const escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/;
const escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, 'g');
const escapeReplacements = {
'&': '&amp;',
'<': '&lt;',
Expand Down
6 changes: 2 additions & 4 deletions test/specs/commonmark/commonmark.0.30.json
Expand Up @@ -221,8 +221,7 @@
"example": 28,
"start_line": 691,
"end_line": 701,
"section": "Entity and numeric character references",
"shouldFail": true
"section": "Entity and numeric character references"
},
{
"markdown": "&copy\n",
Expand Down Expand Up @@ -272,8 +271,7 @@
"example": 34,
"start_line": 752,
"end_line": 759,
"section": "Entity and numeric character references",
"shouldFail": true
"section": "Entity and numeric character references"
},
{
"markdown": "`f&ouml;&ouml;`\n",
Expand Down
6 changes: 2 additions & 4 deletions test/specs/gfm/commonmark.0.30.json
Expand Up @@ -221,8 +221,7 @@
"example": 28,
"start_line": 691,
"end_line": 701,
"section": "Entity and numeric character references",
"shouldFail": true
"section": "Entity and numeric character references"
},
{
"markdown": "&copy\n",
Expand Down Expand Up @@ -272,8 +271,7 @@
"example": 34,
"start_line": 752,
"end_line": 759,
"section": "Entity and numeric character references",
"shouldFail": true
"section": "Entity and numeric character references"
},
{
"markdown": "`f&ouml;&ouml;`\n",
Expand Down

1 comment on commit 36a2b63

@vercel
Copy link

@vercel vercel bot commented on 36a2b63 Nov 20, 2022

Choose a reason for hiding this comment

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

Please sign in to comment.