Skip to content

Commit

Permalink
fix: dompurify
Browse files Browse the repository at this point in the history
  • Loading branch information
vfshera committed Oct 6, 2023
1 parent d844295 commit 05a14ae
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

## Features

- [x] Support for Laravel [9.x](/assets/docs/9.x) and [10.x](/assets/docs/10.x) Docs
- [x] Support for [10.x](/assets/docs/10.x) Docs
- [x] Highlighted Codeblocks
- [ ] More soon...

Expand All @@ -31,7 +31,6 @@
- Svelte Webviews
- [Markedjs](https://github.com/markedjs/marked)
- [Highlightjs](https://github.com/highlightjs/highlight.js/) with GitHub Dark Theme and [Blade Language](https://github.com/miken32/highlightjs-blade)
- [DOMPurify](https://github.com/cure53/DOMPurify) to sanitize html ofcos

#### Theme

Expand Down
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,27 +53,26 @@
}
},
"scripts": {
"docs:generate": "pnpm run compile && node out/generator/Generator.js",
"docs:generate": "pnpm run compile && node dist/generator/Generator.js",
"vscode:prepublish": "pnpm run compile",
"compile": "tsc -p ./",
"pretest": "pnpm run compile && pnpm run lint",
"lint": "eslint src --ext ts",
"test": "node ./out/test/runTest.js",
"test": "node ./dist/test/runTest.js",
"watch": "concurrently \"cd webview-ui && pnpm run dev\" \"tsc -watch -p ./\"",
"install:all": "pnpm install && cd webview-ui && pnpm install",
"start:webview": "cd webview-ui && pnpm run dev",
"build:webview": "cd webview-ui && pnpm run build"
"build:webview": "cd webview-ui && pnpm run build",
"build:all": "pnpm run build:webview && pnpm run compile"
},
"devDependencies": {
"@types/dompurify": "^3.0.3",
"@types/mocha": "^10.0.2",
"@types/node": "~20.8.2",
"@types/vscode": "^1.83.0",
"@typescript-eslint/eslint-plugin": "^6.7.3",
"@typescript-eslint/parser": "^6.7.3",
"@vscode/test-electron": "^2.3.4",
"concurrently": "^8.2.1",
"dompurify": "^3.0.6",
"eslint": "^8.50.0",
"glob": "^10.3.10",
"highlight.js": "^11.8.0",
Expand Down
3 changes: 1 addition & 2 deletions src/generator/Generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,8 @@ export default class Generator {
const fileContents = getDocContents(f.link);

const HTML = await marked.parse(fileContents);
const safeHTML = DOMPurify.sanitize(HTML);

fs.writeFile(fileName, safeHTML, (err) => {
fs.writeFile(fileName, HTML, (err) => {
if (err) {
throw err;
}
Expand Down
2 changes: 1 addition & 1 deletion webview-ui/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import svelte from "rollup-plugin-svelte";
import commonjs from "@rollup/plugin-commonjs";
import resolve from "@rollup/plugin-node-resolve";
import livereload from "rollup-plugin-livereload";
import { terser } from "@rollup/plugin-terser";
import terser from "@rollup/plugin-terser";
import sveltePreprocess from "svelte-preprocess";
import typescript from "@rollup/plugin-typescript";
import css from "rollup-plugin-css-only";
Expand Down

0 comments on commit 05a14ae

Please sign in to comment.