move type-link processing to build stage

This commit is contained in:
outfoxxed 2024-10-09 01:50:21 -07:00
parent ab2a9ca7ed
commit 6d353e0c6b
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
15 changed files with 161 additions and 300 deletions

View file

@ -1,8 +1,4 @@
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 * as markdownUtils from "./markdown.ts";
import {
// Flag,
@ -10,7 +6,8 @@ import {
Tag,
FourDiamonds,
RoundBrackets,
} from "@icons";
// @icons breaks when imported indirectly from astro.config.mjs
} from "../../components/icons.tsx";
import type {
ConfigHeading,
ConfigTOC,
@ -78,21 +75,8 @@ export function groupRoutes(routes: RouteData[]): GroupedRoutes {
}, defaultValue);
}
export function parseMarkdown(text?: string, title?: string) {
if (!text) {
return unified()
.use(remarkParse)
.use(remarkRehype)
.use(rehypeStringify)
.process(title);
}
return unified()
.use(remarkParse)
.use(remarkAlert)
.use(remarkRehype)
.use(rehypeStringify)
.process(text);
export async function processQsMarkdown(markdown: string): Promise<string> {
return await markdownUtils.processMarkdown(markdown);
}
export function getQMLTypeLinkObject(unparsed: string) {