Skip to content

Commit

Permalink
Revert "chore: Remove dompurify (#1490)"
Browse files Browse the repository at this point in the history
This reverts commit e2c0853.
  • Loading branch information
Koooooo-7 authored Oct 26, 2022
1 parent b787e6c commit 4e642d9
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 279 deletions.
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"*.js": "eslint --fix"
},
"dependencies": {
"dompurify": "^2.3.1",
"marked": "^1.2.9",
"medium-zoom": "^1.0.6",
"opencollective-postinstall": "^2.0.2",
Expand Down
7 changes: 4 additions & 3 deletions packages/docsify-server-renderer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { resolve, basename } from 'path';
import resolvePathname from 'resolve-pathname';
import fetch from 'node-fetch';
import debug from 'debug';
import DOMPurify from 'dompurify';
import { AbstractHistory } from '../../src/core/router/history/abstract';
import { Compiler } from '../../src/core/render/compiler';
import { isAbsolutePath } from '../../src/core/router/util';
Expand Down Expand Up @@ -122,10 +123,10 @@ export default class Renderer {
this._renderHtml('cover', await this._render(coverFile), 'cover');
}

const html = this.html;

const html = this.isRemoteUrl
? DOMPurify.sanitize(this.html, { ADD_TAGS: ['script'] })
: this.html;
this.html = this.template;

return html;
}

Expand Down
Loading

0 comments on commit 4e642d9

Please sign in to comment.