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

@ -18,14 +18,15 @@
"@types/node": "^20.14.11",
"astro": "^4.15.9",
"astro-breadcrumbs": "^2.3.1",
"marked": "^14.1.0",
"marked-alert": "^2.0.2",
"node": "npm:22.7.0",
"rehype-stringify": "^10.0.1",
"remark-github-blockquote-alert": "^1.2.1",
"remark-parse": "^11.0.0",
"remark-rehype": "^11.1.1",
"solid-devtools": "^0.30.1",
"solid-js": "^1.8.18",
"typescript": "^5.5.3"
"typescript": "^5.5.3",
"unified": "^11.0.5"
},
"devDependencies": {
"@astrojs/ts-plugin": "^1.10.2",

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) {

View file

@ -4985,24 +4985,6 @@ __metadata:
languageName: node
linkType: hard
"marked-alert@npm:^2.0.2":
version: 2.1.0
resolution: "marked-alert@npm:2.1.0"
peerDependencies:
marked: ">=7.0.0"
checksum: 10c0/36f684c30672f39c819dd7c225dc9841635da1df94cf0724ae84c468044fec1c9d06d55e6f6bb565992331e5ce1fd8dcf119c3ed7897b927fac4f4e884d51816
languageName: node
linkType: hard
"marked@npm:^14.1.0":
version: 14.1.2
resolution: "marked@npm:14.1.2"
bin:
marked: bin/marked.js
checksum: 10c0/fb636a97a2f11acf4cca092836020281ff3bc573f3295b4f4639135a6188e4815b910ec8572eb5686e25580c9c383daf605b4a00fcb5e5626e5c65914755e4bd
languageName: node
linkType: hard
"mdast-util-definitions@npm:^6.0.0":
version: 6.0.0
resolution: "mdast-util-definitions@npm:6.0.0"
@ -6329,16 +6311,17 @@ __metadata:
"@types/node": "npm:^20.14.11"
astro: "npm:^4.15.9"
astro-breadcrumbs: "npm:^2.3.1"
marked: "npm:^14.1.0"
marked-alert: "npm:^2.0.2"
node: "npm:22.7.0"
pagefind: "npm:^1.1.1"
rehype-stringify: "npm:^10.0.1"
remark-github-blockquote-alert: "npm:^1.2.1"
remark-parse: "npm:^11.0.0"
remark-rehype: "npm:^11.1.1"
shiki: "npm:^1.11.0"
solid-devtools: "npm:^0.30.1"
solid-js: "npm:^1.8.18"
typescript: "npm:^5.5.3"
unified: "npm:^11.0.5"
languageName: unknown
linkType: soft
@ -6399,7 +6382,7 @@ __metadata:
languageName: node
linkType: hard
"rehype-stringify@npm:^10.0.0":
"rehype-stringify@npm:^10.0.0, rehype-stringify@npm:^10.0.1":
version: 10.0.1
resolution: "rehype-stringify@npm:10.0.1"
dependencies:
@ -6490,7 +6473,7 @@ __metadata:
languageName: node
linkType: hard
"remark-rehype@npm:^11.0.0, remark-rehype@npm:^11.1.0":
"remark-rehype@npm:^11.0.0, remark-rehype@npm:^11.1.0, remark-rehype@npm:^11.1.1":
version: 11.1.1
resolution: "remark-rehype@npm:11.1.1"
dependencies: