Skip to content

Commit

Permalink
Speed up decoding HTML Entities.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdevils committed Mar 27, 2021
1 parent 80f63d1 commit 2433b6b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/common.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use strict";

import encode from "mdurl/encode.js";
import { decodeHTML } from "entities";
import { decodeEntity } from "html-entities";

var C_BACKSLASH = 92;

Expand Down Expand Up @@ -58,7 +58,7 @@ var unescapeChar = function(s) {
if (s.charCodeAt(0) === C_BACKSLASH) {
return s.charAt(1);
} else {
return decodeHTML(s);
return decodeEntity(s);
}
};

Expand Down
4 changes: 2 additions & 2 deletions lib/inlines.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import Node from "./node.js";
import * as common from "./common.js";
import fromCodePoint from "./from-code-point.js";
import { decodeHTML } from "entities";
import { decodeEntity } from "html-entities";
import "string.prototype.repeat"; // Polyfill for String.prototype.repeat

var normalizeURI = common.normalizeURI;
Expand Down Expand Up @@ -756,7 +756,7 @@ var removeBracket = function() {
var parseEntity = function(block) {
var m;
if ((m = this.match(reEntityHere))) {
block.appendChild(text(decodeHTML(m)));
block.appendChild(text(decodeEntity(m)));
return true;
} else {
return false;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"pretest": "npm run build"
},
"dependencies": {
"entities": "~2.0",
"html-entities": "^2.2.0",
"mdurl": "~1.0.1",
"minimist": ">=1.2.2",
"string.prototype.repeat": "^0.2.0"
Expand Down

0 comments on commit 2433b6b

Please sign in to comment.