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