diff --git a/src/services/export/markdown.spec.ts b/src/services/export/markdown.spec.ts index 9368e11a6..524e4eb69 100644 --- a/src/services/export/markdown.spec.ts +++ b/src/services/export/markdown.spec.ts @@ -255,9 +255,10 @@ describe("Markdown export", () => { it("preserves image verbatim if it has a width or height attribute", () => { const scenarios = [ - ``, - ``, - `` + /*html*/``, + /*html*/``, + /*html*/``, + /*html*/`` ]; for (const expected of scenarios) { const html = /*html*/`

${expected}

`; diff --git a/src/services/html_sanitizer.ts b/src/services/html_sanitizer.ts index a86c15bb3..c0ebaf152 100644 --- a/src/services/html_sanitizer.ts +++ b/src/services/html_sanitizer.ts @@ -164,6 +164,8 @@ function sanitize(dirtyHtml: string) { }, img: { "aspect-ratio": [ /^\d+\/\d+$/ ], + width: sizeRegex, + height: sizeRegex }, table: { "border-color": colorRegex, diff --git a/src/services/import/markdown.spec.ts b/src/services/import/markdown.spec.ts index 9288350cf..f6b541163 100644 --- a/src/services/import/markdown.spec.ts +++ b/src/services/import/markdown.spec.ts @@ -163,10 +163,11 @@ second line 2
  1. Hello
  2. { + it("preserves figures and images with sizes", () => { const scenarios = [ /*html*/`
    `, - /*html*/`
    ` + /*html*/`
    `, + /*html*/`` ]; for (const scenario of scenarios) {