mirror of
https://github.com/zadam/trilium.git
synced 2025-11-07 05:46:10 +01:00
18 lines
522 B
TypeScript
18 lines
522 B
TypeScript
|
|
"use strict";
|
||
|
|
|
||
|
|
import marked = require("marked");
|
||
|
|
import htmlSanitizer = require('../html_sanitizer');
|
||
|
|
import importUtils = require('./utils');
|
||
|
|
|
||
|
|
function renderToHtml(content: string, title: string) {
|
||
|
|
const html = marked.parse(content, {
|
||
|
|
async: false
|
||
|
|
}); // FIXME: mangle and headerIds does not seem to exist in marked
|
||
|
|
const h1Handled = importUtils.handleH1(html, title); // h1 handling needs to come before sanitization
|
||
|
|
return htmlSanitizer.sanitize(h1Handled);
|
||
|
|
}
|
||
|
|
|
||
|
|
export = {
|
||
|
|
renderToHtml
|
||
|
|
};
|