Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nanogiants/vue3-sanitize-html

Package Overview
Dependencies
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nanogiants/vue3-sanitize-html

This package contains a Vue 3 directive which adds v-sanitize-html to an element.

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
37
decreased by-73.57%
Maintainers
3
Weekly downloads
 
Created
Source

vue3-sanitize-html

This package contains a Vue 3 directive which adds v-sanitize-html to an element.

Installation

npm i sanitize-html
npm i @nanogiants/vue3-sanitize-html
#optional
npm i @types/sanitize-html -D
# or
yarn add sanitize-html
yarn add @nanogiants/vue3-sanitize-html
# optional
yarn add @types/sanitize-html -D

Usage

main.ts
import { vSanitizeHtml } from '@nanogiants/vue3-sanitize-html';
import App from './App.vue';

const app = createApp(App);
app.directive('sanitize-html', vSanitizeHtml);
component.vue
<template>
  <div v-sanitize-html="{ html }">test</div>
</template>

<script setup lang="ts">
const html = '<div><span>Test</span><img src="X" onerror="alert(document.domain)"></div>';
</script>
component.vue with options
<template>
  <div v-sanitize-html="{ html, options }">test</div>
</template>

<script setup lang="ts">
import sanitize from 'sanitize-html';

const html = '<div><span>Test</span><img src="X" onerror="alert(document.domain)"></div>';
const options: sanitize.IOptions = {
  allowedTags: [],
};
</script>

args

argtype
value{ html: string, options?: sanitize.IOptions }
import sanitize from 'sanitize-html';

const html = '<div>Hello World</div>';
const options: sanitize.IOptions = {
  allowedTags: [],
};

<div v-sanitize-html="{ html, options}"></div>

License

MIT

Keywords

FAQs

Package last updated on 16 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc