From 48e67fe05398dc4b1fca12db36c1b37bb341277a Mon Sep 17 00:00:00 2001 From: Tony Sullivan Date: Mon, 20 Jun 2022 19:09:35 +0000 Subject: [PATCH] Encode ampersands in markdown code blocks (#3630) * encode ampersands in markdown code blocks * chore: add changeset * nit: fixing test case description --- .changeset/pink-pugs-beg.md | 5 ++++ packages/markdown/remark/src/rehype-escape.ts | 2 +- .../markdown/remark/test/expressions.test.js | 29 ++++++++++++++++++- 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 .changeset/pink-pugs-beg.md diff --git a/.changeset/pink-pugs-beg.md b/.changeset/pink-pugs-beg.md new file mode 100644 index 0000000000..ee78d3d718 --- /dev/null +++ b/.changeset/pink-pugs-beg.md @@ -0,0 +1,5 @@ +--- +'@astrojs/markdown-remark': patch +--- + +Encodes ampersand characters in code blocks diff --git a/packages/markdown/remark/src/rehype-escape.ts b/packages/markdown/remark/src/rehype-escape.ts index a32027b89e..e776c1bb1b 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 `