diff options
Diffstat (limited to 'src/micromark-encode.ts')
-rw-r--r-- | src/micromark-encode.ts | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/micromark-encode.ts b/src/micromark-encode.ts index e3b328224..f9e863fdd 100644 --- a/src/micromark-encode.ts +++ b/src/micromark-encode.ts @@ -11,12 +11,14 @@ const characterReferences = { type EncodedChars = '"' | '&' | '<' | '>' | '{' | '}'; +/** Encode HTML entity */ function encode(value: string): string { return value.replace(/["&<>{}]/g, (raw: string) => { return '&' + characterReferences[raw as EncodedChars] + ';'; }); } +/** Encode Markdown node */ function encodeToken(this: Record<string, () => void>) { const token: Token = arguments[0]; const serialize = (this.sliceSerialize as unknown) as (t: Token) => string; |