diff --git a/src/core/components/providers/markdown.jsx b/src/core/components/providers/markdown.jsx index a4cbf3f9..9707ece6 100644 --- a/src/core/components/providers/markdown.jsx +++ b/src/core/components/providers/markdown.jsx @@ -46,6 +46,7 @@ const sanitizeOptions = { "td": [ "colspan" ], "*": [ "class" ] }, + allowedSchemesByTag: { img: [ "http", "https", "data" ] }, textFilter: function(text) { return text.replace(/"/g, "\"") } diff --git a/test/components/markdown.js b/test/components/markdown.js index c3a716a3..cf208510 100644 --- a/test/components/markdown.js +++ b/test/components/markdown.js @@ -24,6 +24,18 @@ describe("Markdown component", function() { const el = render() expect(el.html()).toEqual(`

\n
`) }) + + it("allows image elements with https scheme", function() { + const str = `![Image alt text](https://image.source "Image title")` + const el = render() + expect(el.html()).toEqual(`

\n
`) + }) + + it("allows image elements with data scheme", function() { + const str = `` + const el = render() + expect(el.html()).toEqual(`

` + str + `

\n
`) + }) it("allows heading elements", function() { const str = ` @@ -51,6 +63,18 @@ describe("Markdown component", function() { expect(el.html()).toEqual(`

`) }) + it("allows image elements with https scheme", function() { + const str = `![Image alt text](https://image.source "Image title")` + const el = render() + expect(el.html()).toEqual(`

`) + }) + + it("allows image elements with data scheme", function() { + const str = `` + const el = render() + expect(el.html()).toEqual(`
` + str + `
`) + }) + it("allows heading elements", function() { const str = ` # h1