diff --git a/src/core/components/providers/markdown.jsx b/src/core/components/providers/markdown.jsx index ee2ddec2e351d70da3706d191a818e115a6730a4..69c5cc1d68f4cbf74e580a0a3dae7c1f73ad378f 100644 --- a/src/core/components/providers/markdown.jsx +++ b/src/core/components/providers/markdown.jsx @@ -19,6 +19,10 @@ DomPurify.addHook("beforeSanitizeElements", function (current, ) { const isPlainText = (str) => /^[A-Z\s0-9!?\.]+$/gi.test(str) function Markdown({ source, className = "" }) { + if (typeof source !== "string") { + return null + } + if(isPlainText(source)) { // If the source text is not Markdown, // let's save some time and just render it. diff --git a/src/core/plugins/oas3/wrap-components/markdown.jsx b/src/core/plugins/oas3/wrap-components/markdown.jsx index 51c44a05e221ad2eb5741f9ec5fe37d0d3660000..432333e615d759c06c2fa91f9402bf56a752468a 100644 --- a/src/core/plugins/oas3/wrap-components/markdown.jsx +++ b/src/core/plugins/oas3/wrap-components/markdown.jsx @@ -10,6 +10,10 @@ parser.block.ruler.enable(["table"]) parser.set({ linkTarget: "_blank" }) export const Markdown = ({ source, className = "" }) => { + if(typeof source !== "string") { + return null + } + if ( source ) { const html = parser.render(source) const sanitized = sanitizer(html)