|
1 | 1 | <script> |
2 | 2 | import { onDestroy } from 'svelte'; |
3 | | - import { marked } from 'marked'; |
| 3 | + import { marked } from '$lib/utils/marked/config'; |
4 | 4 | import { replaceTokens, processResponseContent } from '$lib/utils'; |
5 | 5 | import { user } from '$lib/stores'; |
6 | 6 |
|
7 | | - import markedExtension from '$lib/utils/marked/extension'; |
8 | | - import markedKatexExtension from '$lib/utils/marked/katex-extension'; |
9 | | - import { disableSingleTilde } from '$lib/utils/marked/strikethrough-extension'; |
10 | | - import { mentionExtension } from '$lib/utils/marked/mention-extension'; |
11 | | -
|
12 | 7 | import MarkdownTokens from './Markdown/MarkdownTokens.svelte'; |
13 | | - import footnoteExtension from '$lib/utils/marked/footnote-extension'; |
14 | | - import citationExtension from '$lib/utils/marked/citation-extension'; |
15 | 8 |
|
16 | 9 | export let id = ''; |
17 | 10 | export let content; |
|
37 | 30 | let tokens = []; |
38 | 31 | let pendingUpdate = null; |
39 | 32 |
|
40 | | - const options = { |
41 | | - throwOnError: false, |
42 | | - breaks: true |
43 | | - }; |
44 | | -
|
45 | | - marked.use(markedKatexExtension(options)); |
46 | | - marked.use(markedExtension(options)); |
47 | | - marked.use(citationExtension(options)); |
48 | | - marked.use(footnoteExtension(options)); |
49 | | - marked.use(disableSingleTilde); |
50 | | - marked.use({ |
51 | | - extensions: [ |
52 | | - mentionExtension({ triggerChar: '@' }), |
53 | | - mentionExtension({ triggerChar: '#' }), |
54 | | - mentionExtension({ triggerChar: '$' }) |
55 | | - ] |
56 | | - }); |
57 | | -
|
58 | 33 | const parseTokens = () => { |
59 | 34 | tokens = marked.lexer(replaceTokens(processResponseContent(content), model?.name, $user?.name)); |
60 | 35 | }; |
|
0 commit comments