Skip to content

Commit d583b1f

Browse files
authored
chore: marked tree-shaking(possible) (#116)
1 parent d2edc90 commit d583b1f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.changeset/many-pandas-agree.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+
import `Lexer` only for possible tree-shaking

packages/streamdown/lib/parse-blocks.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { marked } from "marked";
1+
import { Lexer } from "marked";
22

33
export const parseMarkdownIntoBlocks = (markdown: string): string[] => {
4-
const tokens = marked.use({ gfm: true }).lexer(markdown);
4+
const tokens = Lexer.lex(markdown, { gfm: true });
55
const blocks = tokens.map((token) => token.raw);
66

77
// Post-process to merge consecutive blocks that are part of the same math block

0 commit comments

Comments
 (0)