diff options
| author | Adam <[email protected]> | 2025-12-25 19:07:30 -0600 |
|---|---|---|
| committer | Adam <[email protected]> | 2025-12-25 19:07:42 -0600 |
| commit | 583751ecae8514642feacd0f440b1957c3ffcca9 (patch) | |
| tree | 4e7b1da573b9ab4c113dc687a5c4a5d656078f4e | |
| parent | d0a1b5ef96422d863c3fd1e9443486bb58f6c7b2 (diff) | |
| download | opencode-583751ecae8514642feacd0f440b1957c3ffcca9.tar.gz opencode-583751ecae8514642feacd0f440b1957c3ffcca9.zip | |
fix(desktop): markdown rendering perf
| -rw-r--r-- | packages/ui/src/components/markdown.tsx | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/packages/ui/src/components/markdown.tsx b/packages/ui/src/components/markdown.tsx index 380a3c8a4..7615d1737 100644 --- a/packages/ui/src/components/markdown.tsx +++ b/packages/ui/src/components/markdown.tsx @@ -1,21 +1,6 @@ import { useMarked } from "../context/marked" import { ComponentProps, createResource, splitProps } from "solid-js" -function strip(text: string): string { - const trimmed = text.trim() - const match = trimmed.match(/^<([A-Za-z]\w*)>/) - if (!match) return text - - const tagName = match[1] - const closingTag = `</${tagName}>` - if (trimmed.endsWith(closingTag)) { - const content = trimmed.slice(match[0].length, -closingTag.length) - return content.trim() - } - - return text -} - export function Markdown( props: ComponentProps<"div"> & { text: string @@ -26,7 +11,7 @@ export function Markdown( const [local, others] = splitProps(props, ["text", "class", "classList"]) const marked = useMarked() const [html] = createResource( - () => strip(local.text), + () => local.text, async (markdown) => { return marked.parse(markdown) }, |
