diff --git a/packages/docsify-server-renderer/index.js b/packages/docsify-server-renderer/index.js index f023b0b74..005d17a1f 100644 --- a/packages/docsify-server-renderer/index.js +++ b/packages/docsify-server-renderer/index.js @@ -123,7 +123,9 @@ export default class Renderer { this._renderHtml('cover', await this._render(coverFile), 'cover'); } - const html = this.isRemoteUrl ? DOMPurify.sanitize(this.html) : this.html; + const html = this.isRemoteUrl + ? DOMPurify.sanitize(this.html, { ADD_TAGS: ['script'] }) + : this.html; this.html = this.template; return html; } diff --git a/src/core/render/index.js b/src/core/render/index.js index 468e281a9..35666226d 100644 --- a/src/core/render/index.js +++ b/src/core/render/index.js @@ -330,7 +330,9 @@ export function renderMixin(proto) { }, tokens => { html = this.compiler.compile(tokens); - html = this.isRemoteUrl ? DOMPurify.sanitize(html) : html; + html = this.isRemoteUrl + ? DOMPurify.sanitize(html, { ADD_TAGS: ['script'] }) + : html; callback(); next(); }