diff options
author | 2022-06-10 03:33:13 +0000 | |
---|---|---|
committer | 2022-06-10 03:33:13 +0000 | |
commit | 4eb39d57b97b02280588a992de6b77153b24f2bb (patch) | |
tree | 9cadb2d246e46ad86795f72cb7df58536ca2d47d /packages/markdown/remark/src | |
parent | 7f5e71982dc39607339da005457bb32aa4cf96f2 (diff) | |
download | astro-4eb39d57b97b02280588a992de6b77153b24f2bb.tar.gz astro-4eb39d57b97b02280588a992de6b77153b24f2bb.tar.zst astro-4eb39d57b97b02280588a992de6b77153b24f2bb.zip |
[ci] format
Diffstat (limited to 'packages/markdown/remark/src')
-rw-r--r-- | packages/markdown/remark/src/index.ts | 2 | ||||
-rw-r--r-- | packages/markdown/remark/src/rehype-jsx.ts | 7 |
2 files changed, 4 insertions, 5 deletions
diff --git a/packages/markdown/remark/src/index.ts b/packages/markdown/remark/src/index.ts index a11419474..817174e4c 100644 --- a/packages/markdown/remark/src/index.ts +++ b/packages/markdown/remark/src/index.ts @@ -101,7 +101,7 @@ export async function renderMarkdown( .use(rehypeEscape) .use(rehypeIslands) .use([rehypeCollectHeaders]) - .use(rehypeStringify, { allowDangerousHtml: true }) + .use(rehypeStringify, { allowDangerousHtml: true }); let result: string; try { diff --git a/packages/markdown/remark/src/rehype-jsx.ts b/packages/markdown/remark/src/rehype-jsx.ts index 06783ba85..a6761124c 100644 --- a/packages/markdown/remark/src/rehype-jsx.ts +++ b/packages/markdown/remark/src/rehype-jsx.ts @@ -1,5 +1,5 @@ -import type { RehypePlugin } from './types.js'; import { visit } from 'unist-util-visit'; +import type { RehypePlugin } from './types.js'; const MDX_ELEMENTS = ['mdxJsxFlowElement', 'mdxJsxTextElement']; @@ -36,12 +36,11 @@ export default function rehypeJsx(): ReturnType<RehypePlugin> { // from creating a nested link to `www.example.com` if (node.name === 'a') { visit(node, 'element', (el, elIndex, elParent) => { - const isAutolink = ( + const isAutolink = el.tagName === 'a' && el.children.length === 1 && el.children[0].type === 'text' && - el.children[0].value.match(/^(https?:\/\/|www\.)/i) - ); + el.children[0].value.match(/^(https?:\/\/|www\.)/i); // If we found an autolink, remove it by replacing it with its text-only child if (isAutolink) { |