trilium/src/services/import/markdown.js
2024-02-17 21:33:47 +02:00

19 lines
473 B
JavaScript

"use strict";
const marked = require("marked");
const htmlSanitizer = require('../html_sanitizer');
const importUtils = require('./utils');
function renderToHtml(content, title) {
const html = marked.parse(content, {
mangle: false,
headerIds: false
});
const h1Handled = importUtils.handleH1(html, title); // h1 handling needs to come before sanitization
return htmlSanitizer.sanitize(h1Handled);
}
module.exports = {
renderToHtml
};