This commit is contained in:
rattatwinko
2025-06-17 17:38:14 +02:00
parent 7a90128247
commit 528a684699

View File

@@ -26,20 +26,18 @@ async function getPostBySlug(slug: string) {
// Configure marked options
marked.setOptions({
gfm: true,
breaks: true,
headerIds: true,
mangle: false
breaks: true
});
// Convert markdown to HTML
const rawHtml = marked(content);
const rawHtml = marked.parse(content);
// Create a DOM window for DOMPurify
const window = new JSDOM('').window;
const purify = DOMPurify(window);
// Sanitize the HTML
processedContent = purify.sanitize(rawHtml, {
processedContent = purify.sanitize(rawHtml as string, {
ALLOWED_TAGS: [
'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
'p', 'a', 'ul', 'ol', 'li', 'blockquote',