Skip to content

Commit 648e2c3

Browse files
committed
Update micromark to latest beta w/o changes
1 parent 46f6d7f commit 648e2c3

File tree

2 files changed

+8
-43
lines changed

2 files changed

+8
-43
lines changed

dev/lib/index.js

+2-38
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ import {toString} from 'mdast-util-to-string'
7777
import {parse} from 'micromark/lib/parse.js'
7878
import {preprocess} from 'micromark/lib/preprocess.js'
7979
import {postprocess} from 'micromark/lib/postprocess.js'
80+
import {decodeNumericCharacterReference} from 'micromark-util-decode-numeric-character-reference'
8081
import {normalizeIdentifier} from 'micromark-util-normalize-identifier'
8182
import {codes} from 'micromark-util-symbol/codes.js'
82-
import {values} from 'micromark-util-symbol/values.js'
8383
import {constants} from 'micromark-util-symbol/constants.js'
8484
import {types} from 'micromark-util-symbol/types.js'
8585
import {decodeEntity} from 'parse-entities/decode-entity.js'
@@ -895,7 +895,7 @@ function compiler(options = {}) {
895895
let value
896896

897897
if (type) {
898-
value = parseNumericCharacterReference(
898+
value = decodeNumericCharacterReference(
899899
data,
900900
type === types.characterReferenceMarkerNumeric
901901
? constants.numericBaseDecimal
@@ -1095,39 +1095,3 @@ function extension(combined, extension) {
10951095
}
10961096
}
10971097
}
1098-
1099-
// To do: externalize this from `micromark/lib/compile`
1100-
/**
1101-
* Turn the number (in string form as either hexa- or plain decimal) coming from
1102-
* a numeric character reference into a character.
1103-
*
1104-
* @param {string} value
1105-
* @param {number} base
1106-
* @returns {string}
1107-
*/
1108-
function parseNumericCharacterReference(value, base) {
1109-
const code = Number.parseInt(value, base)
1110-
1111-
if (
1112-
// C0 except for HT, LF, FF, CR, space
1113-
code < codes.ht ||
1114-
code === codes.vt ||
1115-
(code > codes.cr && code < codes.space) ||
1116-
// Control character (DEL) of the basic block and C1 controls.
1117-
(code > codes.tilde && code < 160) ||
1118-
// Lone high surrogates and low surrogates.
1119-
/* c8 ignore next */
1120-
(code > 55295 && code < 57344) ||
1121-
// Noncharacters.
1122-
/* c8 ignore next */
1123-
(code > 64975 && code < 65008) ||
1124-
(code & 65535) === 65535 ||
1125-
(code & 65535) === 65534 ||
1126-
// Out of range
1127-
code > 1114111
1128-
) {
1129-
return values.replacementCharacter
1130-
}
1131-
1132-
return String.fromCharCode(code)
1133-
}

package.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@
4444
"@types/mdast": "^3.0.0",
4545
"@types/unist": "^2.0.0",
4646
"mdast-util-to-string": "^3.0.0",
47-
"micromark": "^3.0.0-alpha.3",
48-
"micromark-util-normalize-identifier": "^1.0.0-alpha.3",
49-
"micromark-util-symbol": "^1.0.0-alpha.3",
50-
"micromark-util-types": "^1.0.0-alpha.3",
47+
"micromark": "^3.0.0-beta.1",
48+
"micromark-util-decode-numeric-character-reference": "^1.0.0-beta.1",
49+
"micromark-util-normalize-identifier": "^1.0.0-beta.1",
50+
"micromark-util-symbol": "^1.0.0-beta.1",
51+
"micromark-util-types": "^1.0.0-beta.1",
5152
"parse-entities": "^3.0.0",
5253
"unist-util-stringify-position": "^3.0.0"
5354
},
@@ -59,7 +60,7 @@
5960
"gzip-size-cli": "^5.0.0",
6061
"hast-util-to-html": "^8.0.0",
6162
"mdast-util-to-hast": "^11.0.0",
62-
"micromark-build": "^1.0.0-alpha.3",
63+
"micromark-build": "^1.0.0-beta.1",
6364
"prettier": "^2.0.0",
6465
"rehype-parse": "^7.0.0",
6566
"rehype-stringify": "^8.0.0",

0 commit comments

Comments
 (0)