Fix lint errors and show docs explorer on Cmd click

This commit is contained in:
Gregory Schier
2025-07-14 14:52:16 -07:00
parent 6f1fd7a254
commit 0c60d190af
48 changed files with 454 additions and 199 deletions

27
src-web/lib/markdown.ts Normal file
View File

@@ -0,0 +1,27 @@
import rehypeStringify from 'rehype-stringify';
import remarkGfm from 'remark-gfm';
import remarkParse from 'remark-parse';
import remarkRehype from 'remark-rehype';
import { unified } from 'unified';
const renderer = unified()
.use(remarkParse)
.use(remarkGfm)
.use(remarkRehype, {
// handlers: {
// link: (state, node, parent) => {
// return node;
// },
// },
})
.use(rehypeStringify);
export async function renderMarkdown(md: string): Promise<string> {
try {
const r = await renderer.process(md);
return r.toString();
} catch (err) {
console.log('FAILED TO RENDER MARKDOWN', err);
return 'error';
}
}