From 311be6e71ae181178eb9dae453970d6f2e4dbd14 Mon Sep 17 00:00:00 2001 From: Alexey Pyltsyn Date: Mon, 16 Nov 2020 17:21:36 +0300 Subject: [PATCH] fix(v2): escape alt text in img tag (#3757) --- .../transformImage/__tests__/__snapshots__/index.test.js.snap | 2 ++ .../src/remark/transformImage/__tests__/fixtures/img.md | 2 ++ .../docusaurus-mdx-loader/src/remark/transformImage/index.js | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/docusaurus-mdx-loader/src/remark/transformImage/__tests__/__snapshots__/index.test.js.snap b/packages/docusaurus-mdx-loader/src/remark/transformImage/__tests__/__snapshots__/index.test.js.snap index b4af21f6fe0d..46c4e1ddeda2 100644 --- a/packages/docusaurus-mdx-loader/src/remark/transformImage/__tests__/__snapshots__/index.test.js.snap +++ b/packages/docusaurus-mdx-loader/src/remark/transformImage/__tests__/__snapshots__/index.test.js.snap @@ -18,6 +18,8 @@ exports[`transformImage plugin transform md images to 1`] = ` {\\"img\\"} {\\"img\\"} +{\\"img + ## Heading \`\`\`md diff --git a/packages/docusaurus-mdx-loader/src/remark/transformImage/__tests__/fixtures/img.md b/packages/docusaurus-mdx-loader/src/remark/transformImage/__tests__/fixtures/img.md index 1959b19e23e6..0ef7fc05350e 100644 --- a/packages/docusaurus-mdx-loader/src/remark/transformImage/__tests__/fixtures/img.md +++ b/packages/docusaurus-mdx-loader/src/remark/transformImage/__tests__/fixtures/img.md @@ -6,6 +6,8 @@ ![img](./img.png 'Title') ![img](/img.png) +![img with "quotes"](./img.png ''Quoted' title') + ## Heading ```md diff --git a/packages/docusaurus-mdx-loader/src/remark/transformImage/index.js b/packages/docusaurus-mdx-loader/src/remark/transformImage/index.js index 20797e3eaded..4d67ef9cd758 100644 --- a/packages/docusaurus-mdx-loader/src/remark/transformImage/index.js +++ b/packages/docusaurus-mdx-loader/src/remark/transformImage/index.js @@ -19,7 +19,7 @@ const { const createJSX = (node, pathUrl) => { node.type = 'jsx'; - node.value = `