From 1ea02a198df9c1dd78490b505c1fe029606c9c61 Mon Sep 17 00:00:00 2001 From: mohamed yahia Date: Fri, 5 Jan 2024 15:54:53 +0200 Subject: [PATCH] [tags-extraction][xs]: Hashtag in inline code incorrectly parsed as a tag #106 --- __mocks__/content/index.mdx | 1 + src/lib/parseFile.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/__mocks__/content/index.mdx b/__mocks__/content/index.mdx index 7245004..cc051ef 100644 --- a/__mocks__/content/index.mdx +++ b/__mocks__/content/index.mdx @@ -31,4 +31,5 @@ Another tag: #태그이름 # #--------------------------------------------------------------------------------------- ``` +`#inline-code-tag` #4874 \ No newline at end of file diff --git a/src/lib/parseFile.ts b/src/lib/parseFile.ts index 30e4d3d..2bdb898 100644 --- a/src/lib/parseFile.ts +++ b/src/lib/parseFile.ts @@ -66,8 +66,8 @@ export const extractTagsFromBody = (ast: Root) => { const nodes = selectAll("*", ast); for (let index = 0; index < nodes.length; index++) { const node: any = nodes[index]; - const textContent = node.value; // extractTextWithoutCodeBlocks(node); - if (textContent && node.type !== "code") { + const textContent = node.value; + if (textContent && node.type !== "code" && node.type !== "inlineCode") { const textTags = extractTags(textContent); tags = tags.concat(textTags); }