diff --git a/src/core/components/providers/markdown.jsx b/src/core/components/providers/markdown.jsx index 35ad0c5fc09..ec096d5f8b1 100644 --- a/src/core/components/providers/markdown.jsx +++ b/src/core/components/providers/markdown.jsx @@ -29,10 +29,12 @@ Markdown.propTypes = { export default Markdown const sanitizeOptions = { - allowedTags: sanitize.defaults.allowedTags.concat([ "h1", "h2", "img" ]), + allowedTags: sanitize.defaults.allowedTags.concat([ "h1", "h2", "img", "span" ]), allowedAttributes: { ...sanitize.defaults.allowedAttributes, - "img": sanitize.defaults.allowedAttributes.img.concat(["title"]) + "img": sanitize.defaults.allowedAttributes.img.concat(["title"]), + "td": [ "colspan" ], + "*": [ "class" ] }, textFilter: function(text) { return text.replace(/"/g, "\"") diff --git a/test/components/markdown.js b/test/components/markdown.js index 65b80c0ecd5..c3a716a3f46 100644 --- a/test/components/markdown.js +++ b/test/components/markdown.js @@ -7,6 +7,18 @@ import { Markdown as OAS3Markdown } from "corePlugins/oas3/wrap-components/markd describe("Markdown component", function() { describe("Swagger 2.0", function() { + it("allows span elements with class attrib", function() { + const str = `ONE` + const el = render() + expect(el.html()).toEqual(`

ONE

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