use only one markdown processing pipeline

Removes marked in favor of remark which is already used by astro.
This commit is contained in:
outfoxxed 2024-10-08 20:42:05 -07:00
parent 0d5909ff58
commit ab2a9ca7ed
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
3 changed files with 25 additions and 29 deletions

View file

@ -1,5 +1,8 @@
import { marked } from "marked";
import markedAlert from "marked-alert";
import { unified } from "unified";
import remarkParse from "remark-parse";
import remarkRehype from "remark-rehype";
import rehypeStringify from "rehype-stringify";
import { remarkAlert } from "remark-github-blockquote-alert";
import {
// Flag,
@ -77,10 +80,19 @@ export function groupRoutes(routes: RouteData[]): GroupedRoutes {
export function parseMarkdown(text?: string, title?: string) {
if (!text) {
return marked.parse(`${title}`);
return unified()
.use(remarkParse)
.use(remarkRehype)
.use(rehypeStringify)
.process(title);
}
return marked.use(markedAlert()).parse(text);
return unified()
.use(remarkParse)
.use(remarkAlert)
.use(remarkRehype)
.use(rehypeStringify)
.process(text);
}
export function getQMLTypeLinkObject(unparsed: string) {