diff --git a/src/css/prose.css b/src/css/prose.css index c32683e9..4e5c95bf 100644 --- a/src/css/prose.css +++ b/src/css/prose.css @@ -178,7 +178,15 @@ } .prose .math { - @apply max-w-full inline-block overflow-x-scroll; + @apply max-w-full; +} + +.prose .katex { + @apply overflow-x-auto; +} + +.prose .katex-html { + @apply py-2; } .xlog-comment .prose { diff --git a/src/markdown/index.ts b/src/markdown/index.ts index 157db2fa..73def770 100644 --- a/src/markdown/index.ts +++ b/src/markdown/index.ts @@ -108,7 +108,6 @@ export const renderPageContent = ( .use(remarkMermaid) .use(remarkMath) .use(remarkRehype, { allowDangerousHtml: true }) - .use(rehypeKatex) // There may be $ symbol parsing errors .use(rehypeStringify) .use(rehypeRaw) .use(rehypeImage, { env }) @@ -142,10 +141,6 @@ export const renderPageContent = ( }, }) .use(rehypeSanitize, sanitizeScheme) - .use(rehypePrism, { - ignoreMissing: true, - showLineNumbers: true, - }) .use(rehypeTable) .use(rehypeExternalLink) .use(rehypeWrapCode) @@ -183,6 +178,11 @@ export const renderPageContent = ( } }, }) + .use(rehypePrism, { + ignoreMissing: true, + showLineNumbers: true, + }) + .use(rehypeKatex) // There may be $ symbol parsing errors .use(html ? () => (tree: any) => {} : rehypeReact, { createElement: createElement, components: {