diff --git a/src/services/html_sanitizer.ts b/src/services/html_sanitizer.ts index c1e18bb41..b4b6dae32 100644 --- a/src/services/html_sanitizer.ts +++ b/src/services/html_sanitizer.ts @@ -149,7 +149,8 @@ function sanitize(dirtyHtml: string) { allowedTags, allowedAttributes: { "*": ["class", "style", "title", "src", "href", "hash", "disabled", "align", "alt", "center", "data-*"], - input: ["type", "checked"] + input: ["type", "checked"], + img: ["width", "height"] }, allowedStyles: { "*": { @@ -161,6 +162,9 @@ function sanitize(dirtyHtml: string) { width: sizeRegex, height: sizeRegex }, + img: { + "aspect-ratio": [ /^\d+\/\d+$/ ], + }, table: { "border-color": colorRegex, "border-style": [/^\s*(none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset)\s*$/] diff --git a/src/services/import/markdown.spec.ts b/src/services/import/markdown.spec.ts index e25a8bc09..cf75fc1af 100644 --- a/src/services/import/markdown.spec.ts +++ b/src/services/import/markdown.spec.ts @@ -163,6 +163,12 @@ second line 2
  1. Hello
  2. { + const input = `
    `; + const expected = /*html*/`
    `; + expect(markdownService.renderToHtml(input, "Title")).toStrictEqual(expected); + }); + it("converts inline math expressions into Mathtex format", () => { const input = `The equation is\u00a0$e=mc^{2}$.`; const expected = /*html*/`

    The equation is \\(e=mc^{2}\\).

    `;