feat: Added better md styling
All checks were successful
Build and Push App Image / build-and-push (push) Successful in 58s

This commit is contained in:
domrichardson
2026-03-26 11:41:16 +00:00
parent 94f11be77c
commit cf94697d07
7 changed files with 112 additions and 7 deletions

View File

@@ -1,3 +1,19 @@
import { marked } from "marked";
import { markedHighlight } from "marked-highlight";
import hljs from "highlight.js/lib/common";
marked.use(
markedHighlight({
langPrefix: "hljs language-",
highlight(code, lang) {
if (lang && hljs.getLanguage(lang)) {
return hljs.highlight(code, { language: lang }).value;
}
return hljs.highlightAuto(code).value;
},
}),
);
/**
* Preprocesses markdown content to support extended image size syntax:
*
@@ -24,3 +40,7 @@ export function preprocessMarkdown(content) {
return `<img ${attrs}>`;
});
}
export function renderMarkdown(content) {
return marked.parse(preprocessMarkdown(content || ""), { gfm: true });
}