mirror of
https://github.com/zadam/trilium.git
synced 2025-11-12 08:15:52 +01:00
small fixes
This commit is contained in:
@@ -3,19 +3,15 @@ const sanitizeHtml = require('sanitize-html');
|
||||
// intended mainly as protection against XSS via import
|
||||
// secondarily it (partly) protects against "CSS takeover"
|
||||
function sanitize(dirtyHtml) {
|
||||
|
||||
// avoid H1 per https://github.com/zadam/trilium/issues/1552
|
||||
// demote H1, and if that conflicts with existing H2, demote that, etc
|
||||
let transformTags = {};
|
||||
const loweraseHtml = dirtyHtml.toLowerCase();
|
||||
for (let i = 1; i < 6; ++i)
|
||||
{
|
||||
if (loweraseHtml.includes(`<h${i}`))
|
||||
{
|
||||
transformTags[`h${i}`] = `h${i+1}`;
|
||||
const transformTags = {};
|
||||
const lowercasedHtml = dirtyHtml.toLowerCase();
|
||||
for (let i = 1; i < 6; ++i) {
|
||||
if (lowercasedHtml.includes(`<h${i}`)) {
|
||||
transformTags[`h${i}`] = `h${i + 1}`;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user