Skip to content

Commit e94154f

Browse files
temporary fix for error color in rehype katex (vercel#44)
* fix * Hardcode muted foreground color * Update index.tsx * Create metal-hotels-doubt.md --------- Co-authored-by: Hayden Bleasel <hello@haydenbleasel.com>
1 parent ae69c06 commit e94154f

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.changeset/metal-hotels-doubt.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"streamdown": patch
3+
---
4+
5+
temporary fix for error color in rehype katex

packages/streamdown/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ export const Streamdown = memo(
8282
parseMarkdownIntoBlocks(typeof children === 'string' ? children : ''),
8383
[children]
8484
);
85+
const rehypeKatexPlugin = useMemo(
86+
() => () => rehypeKatex({ errorColor: 'var(--color-muted-foreground)' }),
87+
[]
88+
);
8589

8690
return (
8791
<ShikiThemeContext.Provider value={shikiTheme}>
@@ -98,7 +102,7 @@ export const Streamdown = memo(
98102
defaultOrigin={defaultOrigin}
99103
// biome-ignore lint/suspicious/noArrayIndexKey: "required"
100104
key={`${generatedId}-block_${index}`}
101-
rehypePlugins={[rehypeKatex, ...(rehypePlugins ?? [])]}
105+
rehypePlugins={[rehypeKatexPlugin, ...(rehypePlugins ?? [])]}
102106
remarkPlugins={[remarkGfm, remarkMath, ...(remarkPlugins ?? [])]}
103107
shouldParseIncompleteMarkdown={shouldParseIncompleteMarkdown}
104108
/>

0 commit comments

Comments
 (0)