mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-11-30 12:03:59 +01:00
Fix lint errors and show docs explorer on Cmd click
This commit is contained in:
1 parent
6f1fd7a254
commit
0c60d190af
48 files changed
+454
-199
No files matched your search
@@ -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';
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user