feat: Added better md styling
All checks were successful
Build and Push App Image / build-and-push (push) Successful in 58s
All checks were successful
Build and Push App Image / build-and-push (push) Successful in 58s
This commit is contained in:
@@ -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 });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user