Skip to content

Commit 0059ba2

Browse files
committed
Restore ability to execute remote content scripts
1 parent e6c6abb commit 0059ba2

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/docsify-server-renderer/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ export default class Renderer {
123123
this._renderHtml('cover', await this._render(coverFile), 'cover');
124124
}
125125

126-
const html = this.isRemoteUrl ? DOMPurify.sanitize(this.html) : this.html;
126+
const html = this.isRemoteUrl
127+
? DOMPurify.sanitize(this.html, { ADD_TAGS: ['script'] })
128+
: this.html;
127129
this.html = this.template;
128130
return html;
129131
}

src/core/render/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,9 @@ export function renderMixin(proto) {
330330
},
331331
tokens => {
332332
html = this.compiler.compile(tokens);
333-
html = this.isRemoteUrl ? DOMPurify.sanitize(html) : html;
333+
html = this.isRemoteUrl
334+
? DOMPurify.sanitize(html, { ADD_TAGS: ['script'] })
335+
: html;
334336
callback();
335337
next();
336338
}

0 commit comments

Comments
 (0)