From 0097e9fe6440714f788fcafe103d7e7261a15537 Mon Sep 17 00:00:00 2001 From: Innei Date: Wed, 12 Jun 2024 20:58:38 +0800 Subject: [PATCH] fix: remove katex in toc tree Signed-off-by: Innei --- src/components/modules/toc/TocTree.tsx | 2 +- src/components/ui/markdown/parsers/katex.tsx | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/modules/toc/TocTree.tsx b/src/components/modules/toc/TocTree.tsx index c69f4f8c84..9e63e71e81 100644 --- a/src/components/modules/toc/TocTree.tsx +++ b/src/components/modules/toc/TocTree.tsx @@ -77,7 +77,7 @@ export const TocTree: Component< return Array.from($headings).map((el, idx) => { const depth = +el.tagName.slice(1) const elClone = el.cloneNode(true) as HTMLElement - elClone.querySelectorAll('del').forEach((del) => { + elClone.querySelectorAll('del, .katex-container').forEach((del) => { del.remove() }) diff --git a/src/components/ui/markdown/parsers/katex.tsx b/src/components/ui/markdown/parsers/katex.tsx index fe829e182b..3049d52d8a 100644 --- a/src/components/ui/markdown/parsers/katex.tsx +++ b/src/components/ui/markdown/parsers/katex.tsx @@ -59,7 +59,12 @@ const LateX: FC = (props) => { } }, []) - return + return ( + + ) } export const KateXBlockRule: MarkdownToJSX.Rule = {