summaryrefslogtreecommitdiff
path: root/src/markdown-encode.ts
diff options
context:
space:
mode:
authorGravatar Drew Powers <1369770+drwpow@users.noreply.github.com> 2021-03-16 12:37:45 -0600
committerGravatar GitHub <noreply@github.com> 2021-03-16 12:37:45 -0600
commit8c45c4a8567e31a10ae954fa11a0f3f1f94fd89c (patch)
treee526f67e93ed5a7fcf9237c2d30ec536a4a96d7b /src/markdown-encode.ts
parent1f5c7c791fe3595f4c775192ffc6b6a15efb71a1 (diff)
downloadastro-8c45c4a8567e31a10ae954fa11a0f3f1f94fd89c.tar.gz
astro-8c45c4a8567e31a10ae954fa11a0f3f1f94fd89c.tar.zst
astro-8c45c4a8567e31a10ae954fa11a0f3f1f94fd89c.zip
Annoying Lint PR™ (#3)
* Add Prettier + ESLint * Format files
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 };