diff options
author | 2022-06-20 19:09:35 +0000 | |
---|---|---|
committer | 2022-06-20 19:09:35 +0000 | |
commit | 48e67fe05398dc4b1fca12db36c1b37bb341277a (patch) | |
tree | 3ddc969e8ed14fe60589200c085f25832f135005 /packages/markdown/remark/src | |
parent | 509b4f122fc529571492330b53b058114717604d (diff) | |
download | astro-48e67fe05398dc4b1fca12db36c1b37bb341277a.tar.gz astro-48e67fe05398dc4b1fca12db36c1b37bb341277a.tar.zst astro-48e67fe05398dc4b1fca12db36c1b37bb341277a.zip |
Encode ampersands in markdown code blocks (#3630)
* encode ampersands in markdown code blocks
* chore: add changeset
* nit: fixing test case description
Diffstat (limited to 'packages/markdown/remark/src')
-rw-r--r-- | packages/markdown/remark/src/rehype-escape.ts | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/packages/markdown/remark/src/rehype-escape.ts b/packages/markdown/remark/src/rehype-escape.ts index a32027b89..e776c1bb1 100644 --- a/packages/markdown/remark/src/rehype-escape.ts +++ b/packages/markdown/remark/src/rehype-escape.ts @@ -8,7 +8,7 @@ export default function rehypeEscape(): any { // Visit all raw children and escape HTML tags to prevent Markdown code // like "This is a `<script>` tag" from actually opening a script tag visit(el, 'raw', (raw) => { - raw.value = raw.value.replace(/</g, '<').replace(/>/g, '>'); + raw.value = raw.value.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>'); }); } return el; |