mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-31 04:02:26 +08:00
fix(markdown/import): markdown quotes not escaping
This commit is contained in:
parent
749a398128
commit
6a3c44f866
@ -127,4 +127,10 @@ second line 2</code></pre><ul><li>Hello</li><li>world</li></ul><ol><li>Hello</li
|
|||||||
expect(markdownService.renderToHtml(input, "Title")).toStrictEqual(expected);
|
expect(markdownService.renderToHtml(input, "Title")).toStrictEqual(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("does not escape unneeded characters", () => {
|
||||||
|
const input = `It's important to note that these examples are not natively supported by Trilium out of the box; instead, they demonstrate what you can build within Trilium.`;
|
||||||
|
const expected = `<p>It's important to note that these examples are not natively supported by Trilium out of the box; instead, they demonstrate what you can build within Trilium.</p>`;
|
||||||
|
expect(markdownService.renderToHtml(input, "Title")).toStrictEqual(expected);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -82,7 +82,7 @@ function renderToHtml(content: string, title: string) {
|
|||||||
|
|
||||||
// h1 handling needs to come before sanitization
|
// h1 handling needs to come before sanitization
|
||||||
html = importUtils.handleH1(html, title);
|
html = importUtils.handleH1(html, title);
|
||||||
// html = htmlSanitizer.sanitize(html);
|
html = htmlSanitizer.sanitize(html);
|
||||||
|
|
||||||
// Remove slash for self-closing tags to match CKEditor's approach.
|
// Remove slash for self-closing tags to match CKEditor's approach.
|
||||||
html = html.replace(/<(\w+)([^>]*)\s+\/>/g, "<$1$2>");
|
html = html.replace(/<(\w+)([^>]*)\s+\/>/g, "<$1$2>");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user