diff --git a/src/core/components/providers/markdown.jsx b/src/core/components/providers/markdown.jsx index 4a08d79157d..e688f4c4b25 100644 --- a/src/core/components/providers/markdown.jsx +++ b/src/core/components/providers/markdown.jsx @@ -67,6 +67,7 @@ export function sanitizer(str, { useUnsafeMarkdown = false } = {}) { FORBID_TAGS: ["style", "form"], ALLOW_DATA_ATTR, FORBID_ATTR, + RETURN_TRUSTED_TYPE: true }) } sanitizer.hasWarnedAboutDeprecation = false diff --git a/src/core/plugins/oas3/wrap-components/markdown.jsx b/src/core/plugins/oas3/wrap-components/markdown.jsx index 95ca2f4bb03..cd9d13657f8 100644 --- a/src/core/plugins/oas3/wrap-components/markdown.jsx +++ b/src/core/plugins/oas3/wrap-components/markdown.jsx @@ -17,18 +17,18 @@ export const Markdown = ({ source, className = "", getConfigs = () => ({ useUnsa if ( source ) { const { useUnsafeMarkdown } = getConfigs() const html = parser.render(source) - const sanitized = sanitizer(html, { useUnsafeMarkdown }) let trimmed - if(typeof sanitized === "string") { - trimmed = sanitized.trim() - } + if (typeof html === "string") + trimmed = html.trim() + + const sanitized = sanitizer(trimmed, { useUnsafeMarkdown }) return (