Comparing version 3.0.0-alpha.3 to 3.0.0-beta.1
@@ -8,14 +8,2 @@ /** | ||
): Compile | ||
/** | ||
* Turn the number (in string form as either hexa- or plain decimal) coming from | ||
* a numeric character reference into a character. | ||
* | ||
* @param {string} value | ||
* @param {number} base | ||
* @returns {string} | ||
*/ | ||
export function parseNumericCharacterReference( | ||
value: string, | ||
base: number | ||
): string | ||
export type Event = import('micromark-util-types').Event | ||
@@ -22,0 +10,0 @@ export type CompileOptions = import('micromark-util-types').CompileOptions |
@@ -44,2 +44,3 @@ /** | ||
import {push} from 'micromark-util-chunked' | ||
import {decodeNumericCharacterReference} from 'micromark-util-decode-numeric-character-reference' | ||
import {encode as _encode} from 'micromark-util-encode' | ||
@@ -51,3 +52,2 @@ import {normalizeIdentifier} from 'micromark-util-normalize-identifier' | ||
import {types} from 'micromark-util-symbol/types.js' | ||
import {values} from 'micromark-util-symbol/values.js' | ||
@@ -956,3 +956,3 @@ const hasOwnProperty = {}.hasOwnProperty | ||
value = getData('characterReferenceType') | ||
? parseNumericCharacterReference( | ||
? decodeNumericCharacterReference( | ||
value, | ||
@@ -993,34 +993,1 @@ getData('characterReferenceType') === | ||
} | ||
/** | ||
* Turn the number (in string form as either hexa- or plain decimal) coming from | ||
* a numeric character reference into a character. | ||
* | ||
* @param {string} value | ||
* @param {number} base | ||
* @returns {string} | ||
*/ | ||
export function parseNumericCharacterReference(value, base) { | ||
const code = Number.parseInt(value, base) | ||
if ( | ||
// C0 except for HT, LF, FF, CR, space | ||
code < codes.ht || | ||
code === codes.vt || | ||
(code > codes.cr && code < codes.space) || | ||
// Control character (DEL) of the basic block and C1 controls. | ||
(code > codes.tilde && code < 160) || | ||
// Lone high surrogates and low surrogates. | ||
(code > 55295 && code < 57344) || | ||
// Noncharacters. | ||
(code > 64975 && code < 65008) || | ||
(code & 65535) === 65535 || | ||
(code & 65535) === 65534 || | ||
// Out of range | ||
code > 1114111 | ||
) { | ||
return values.replacementCharacter | ||
} | ||
return String.fromCharCode(code) | ||
} |
@@ -8,14 +8,2 @@ /** | ||
): Compile | ||
/** | ||
* Turn the number (in string form as either hexa- or plain decimal) coming from | ||
* a numeric character reference into a character. | ||
* | ||
* @param {string} value | ||
* @param {number} base | ||
* @returns {string} | ||
*/ | ||
export function parseNumericCharacterReference( | ||
value: string, | ||
base: number | ||
): string | ||
export type Event = import('micromark-util-types').Event | ||
@@ -22,0 +10,0 @@ export type CompileOptions = import('micromark-util-types').CompileOptions |
@@ -42,2 +42,3 @@ /** | ||
import {push} from 'micromark-util-chunked' | ||
import {decodeNumericCharacterReference} from 'micromark-util-decode-numeric-character-reference' | ||
import {encode as _encode} from 'micromark-util-encode' | ||
@@ -936,3 +937,3 @@ import {normalizeIdentifier} from 'micromark-util-normalize-identifier' | ||
value = getData('characterReferenceType') | ||
? parseNumericCharacterReference( | ||
? decodeNumericCharacterReference( | ||
value, | ||
@@ -972,30 +973,1 @@ getData('characterReferenceType') === | ||
} | ||
/** | ||
* Turn the number (in string form as either hexa- or plain decimal) coming from | ||
* a numeric character reference into a character. | ||
* | ||
* @param {string} value | ||
* @param {number} base | ||
* @returns {string} | ||
*/ | ||
export function parseNumericCharacterReference(value, base) { | ||
const code = Number.parseInt(value, base) | ||
if ( | ||
// C0 except for HT, LF, FF, CR, space | ||
code < 9 || | ||
code === 11 || | ||
(code > 13 && code < 32) || // Control character (DEL) of the basic block and C1 controls. | ||
(code > 126 && code < 160) || // Lone high surrogates and low surrogates. | ||
(code > 55295 && code < 57344) || // Noncharacters. | ||
(code > 64975 && code < 65008) || | ||
(code & 65535) === 65535 || | ||
(code & 65535) === 65534 || // Out of range | ||
code > 1114111 | ||
) { | ||
return '\uFFFD' | ||
} | ||
return String.fromCharCode(code) | ||
} |
{ | ||
"name": "micromark", | ||
"version": "3.0.0-alpha.3", | ||
"version": "3.0.0-beta.1", | ||
"description": "small commonmark compliant markdown parser with positional info and concrete tokens", | ||
@@ -101,14 +101,15 @@ "license": "MIT", | ||
"debug": "^4.0.0", | ||
"micromark-core-commonmark": "1.0.0-alpha.3", | ||
"micromark-factory-space": "1.0.0-alpha.3", | ||
"micromark-util-character": "1.0.0-alpha.3", | ||
"micromark-util-chunked": "1.0.0-alpha.3", | ||
"micromark-util-combine-extensions": "1.0.0-alpha.3", | ||
"micromark-util-encode": "1.0.0-alpha.3", | ||
"micromark-util-normalize-identifier": "1.0.0-alpha.3", | ||
"micromark-util-resolve-all": "1.0.0-alpha.3", | ||
"micromark-util-sanitize-uri": "1.0.0-alpha.3", | ||
"micromark-util-subtokenize": "1.0.0-alpha.3", | ||
"micromark-util-symbol": "1.0.0-alpha.3", | ||
"micromark-util-types": "1.0.0-alpha.3", | ||
"micromark-core-commonmark": "1.0.0-beta.1", | ||
"micromark-factory-space": "1.0.0-beta.1", | ||
"micromark-util-character": "1.0.0-beta.1", | ||
"micromark-util-chunked": "1.0.0-beta.1", | ||
"micromark-util-combine-extensions": "1.0.0-beta.1", | ||
"micromark-util-decode-numeric-character-reference": "1.0.0-beta.1", | ||
"micromark-util-encode": "1.0.0-beta.1", | ||
"micromark-util-normalize-identifier": "1.0.0-beta.1", | ||
"micromark-util-resolve-all": "1.0.0-beta.1", | ||
"micromark-util-sanitize-uri": "1.0.0-beta.1", | ||
"micromark-util-subtokenize": "1.0.0-beta.1", | ||
"micromark-util-symbol": "1.0.0-beta.1", | ||
"micromark-util-types": "1.0.0-beta.1", | ||
"parse-entities": "^3.0.0" | ||
@@ -115,0 +116,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
169081
16
5430
+ Addedmicromark-util-decode-numeric-character-reference@1.0.0-beta.1
+ Addedmicromark-core-commonmark@1.0.0-beta.1(transitive)
+ Addedmicromark-factory-space@1.0.0-beta.1(transitive)
+ Addedmicromark-util-character@1.0.0-beta.1(transitive)
+ Addedmicromark-util-chunked@1.0.0-beta.1(transitive)
+ Addedmicromark-util-combine-extensions@1.0.0-beta.1(transitive)
+ Addedmicromark-util-decode-numeric-character-reference@1.0.0-beta.1(transitive)
+ Addedmicromark-util-encode@1.0.0-beta.1(transitive)
+ Addedmicromark-util-normalize-identifier@1.0.0-beta.1(transitive)
+ Addedmicromark-util-resolve-all@1.0.0-beta.1(transitive)
+ Addedmicromark-util-sanitize-uri@1.0.0-beta.1(transitive)
+ Addedmicromark-util-subtokenize@1.0.0-beta.1(transitive)
+ Addedmicromark-util-symbol@1.0.0-beta.1(transitive)
+ Addedmicromark-util-types@1.0.0-beta.1(transitive)
- Removedmicromark-core-commonmark@1.0.0-alpha.3(transitive)
- Removedmicromark-factory-space@1.0.0-alpha.3(transitive)
- Removedmicromark-util-character@1.0.0-alpha.3(transitive)
- Removedmicromark-util-chunked@1.0.0-alpha.3(transitive)
- Removedmicromark-util-combine-extensions@1.0.0-alpha.3(transitive)
- Removedmicromark-util-encode@1.0.0-alpha.3(transitive)
- Removedmicromark-util-normalize-identifier@1.0.0-alpha.3(transitive)
- Removedmicromark-util-resolve-all@1.0.0-alpha.3(transitive)
- Removedmicromark-util-sanitize-uri@1.0.0-alpha.3(transitive)
- Removedmicromark-util-subtokenize@1.0.0-alpha.3(transitive)
- Removedmicromark-util-symbol@1.0.0-alpha.3(transitive)
- Removedmicromark-util-types@1.0.0-alpha.3(transitive)