summaryrefslogtreecommitdiff
path: root/src/markdown-encode.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/markdown-encode.ts')
-rw-r--r--src/markdown-encode.ts16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/markdown-encode.ts b/src/markdown-encode.ts
index 0719aaa32..173c63fde 100644
--- a/src/markdown-encode.ts
+++ b/src/markdown-encode.ts
@@ -6,14 +6,14 @@ const characterReferences = {
'<': 'lt',
'>': 'gt',
'{': 'lbrace',
- '}': 'rbrace'
+ '}': 'rbrace',
};
type EncodedChars = '"' | '&' | '<' | '>' | '{' | '}';
function encode(value: string): string {
return value.replace(/["&<>{}]/g, (raw: string) => {
- return '&' + characterReferences[raw as EncodedChars] + ';'
+ return '&' + characterReferences[raw as EncodedChars] + ';';
});
}
@@ -21,14 +21,12 @@ const plugin: HtmlExtension = {
exit: {
codeFlowValue() {
const token: Token = arguments[0];
- const serialize = this.sliceSerialize as unknown as (t: Token) => string;
- const raw = this.raw as unknown as (s: string) => void;
+ const serialize = (this.sliceSerialize as unknown) as (t: Token) => string;
+ const raw = (this.raw as unknown) as (s: string) => void;
const value = serialize(token);
raw(encode(value));
- }
- }
+ },
+ },
};
-export {
- plugin as default
-}; \ No newline at end of file
+export { plugin as default };