From 68e601890d9e54e5f3a69a411bacbdd7e5820292 Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Mon, 28 Mar 2022 09:25:57 +0800 Subject: [PATCH] fix(theme): only parse HTML- and JSX-style comments in MD code --- packages/docusaurus-theme-common/src/utils/codeBlockUtils.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/docusaurus-theme-common/src/utils/codeBlockUtils.ts b/packages/docusaurus-theme-common/src/utils/codeBlockUtils.ts index 8b89983bcbac..dbc24112151c 100644 --- a/packages/docusaurus-theme-common/src/utils/codeBlockUtils.ts +++ b/packages/docusaurus-theme-common/src/utils/codeBlockUtils.ts @@ -61,6 +61,10 @@ function getAllMagicCommentDirectiveStyles(lang: string) { case 'py': return getCommentPattern(['python']); + case 'markdown': + case 'md': + return getCommentPattern(['html', 'jsx']); + default: // all comment types return getCommentPattern(Object.keys(commentPatterns) as CommentType[]);