diff --git a/README.md b/README.md index 94288cb..d3d6ffe 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,24 @@ app.mount('#app') You can use the [linkify options](https://linkify.js.org/docs/options.html). +### Define XSS Options + +```vue + +``` + +You can use the [xss options](https://jsxss.com/en/options#customize-whitelist). + ### Add event listener ```vue diff --git a/src/main.ts b/src/main.ts index ba6a0a6..1b963ca 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,10 +1,14 @@ import { App, Directive } from "@vue/runtime-core"; import linkifyHtml from "linkify-html"; import { Options } from "linkifyjs"; -import xss from "xss"; +import xss, { IFilterXSSOptions } from "xss"; -const linkify = (rawHtml: string, options: Options): string => { - const sanitized = xss(rawHtml); +interface VueLinkifyOptions extends Options { + xssOptions?: IFilterXSSOptions; +} + +const linkify = (rawHtml: string, options: VueLinkifyOptions): string => { + const sanitized = xss(rawHtml, options.xssOptions); return linkifyHtml(sanitized, options); };