Download packages/ui/src/context/marked-parser.test.ts from SaylorTwift/opencode: direct link, hf CLI and curl.
- Browser
- Download file 868 Bytes
-
https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/ui/src/context/marked-parser.test.ts
- Command line
-
hf download hf://SaylorTwift/opencode/packages/ui/src/context/marked-parser.test.ts
-
curl -L -o marked-parser.test.ts https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/ui/src/context/marked-parser.test.ts
868 Bytes
| import { expect, test } from "bun:test" | |
| import { createMarkdownParser } from "./marked-parser" | |
| const parser = createMarkdownParser((code, language) => `<pre data-language="${language}">${code}</pre>`) | |
| test("renders links with application attributes", async () => { | |
| expect(await parser.parse("[OpenCode](https://opencode.ai)")).toBe( | |
| '<p><a href="https://opencode.ai" class="external-link" target="_blank" rel="noopener noreferrer">OpenCode</a></p>\n', | |
| ) | |
| }) | |
| test("renders inline and block math", async () => { | |
| expect(await parser.parse("\\(x^2\\)")).toContain('<span class="katex">') | |
| expect(await parser.parse("$$\nx^2\n$$\n")).toContain('<span class="katex-display">') | |
| }) | |
| test("uses the configured code highlighter", async () => { | |
| expect(await parser.parse("```ts\nconst value = 1\n```\n")).toBe('<pre data-language="ts">const value = 1</pre>\n') | |
| }) | |