# @sika7/silver-html-plugin-sanitize

> silver-html plugin for sanitize.

Latest version **1.0.2** (published 2021-12-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install @sika7/silver-html-plugin-sanitize
pnpm add @sika7/silver-html-plugin-sanitize
yarn add @sika7/silver-html-plugin-sanitize
bun add @sika7/silver-html-plugin-sanitize
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2021-12-09 |
| First published | 2021-12-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=12.0.0 |
| Dependencies | 3 |
| Unpacked size | 10.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | sika7 |
| Maintainers | sika7 |
| Keywords | html-sanitize, silver-html-plugin, silver-html |

## Links

- npm: https://www.npmjs.com/package/@sika7/silver-html-plugin-sanitize
- Repository: https://github.com/sika7/silver-html-plugin-sanitize
- Homepage: https://github.com/sika7/silver-html-plugin-sanitize#readme
- Issues: https://github.com/sika7/silver-html-plugin-sanitize/issues
- npm.io page: https://npm.io/package/@sika7/silver-html-plugin-sanitize

## Dependencies (3)

- [postcss](https://npm.io/package/postcss.md) ^8.4.4
- [typescript](https://npm.io/package/typescript.md) ^4.5.2
- [@sika7/postcss-whitelist-sanitize](https://npm.io/package/@sika7/postcss-whitelist-sanitize.md) ^1.0.0

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2021-12-09
- 1.0.1 — 2021-12-09
- 1.0.0 — 2021-12-08
- 0.0.1 — 2021-12-08

## README

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Test](https://github.com/sika7/silver-html-plugin-sanitize/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/sika7/silver-html-plugin-sanitize/actions/workflows/test.yml)

# @sika7/silver-html-plugin-sanitize

this package is silver-html plugin

## Usage

**Step 1:** Install plugin:

```sh
npm install --save @sika7/silver-html
npm install --save @sika7/silver-html-plugin-sanitize
```

**Step 2:** add a functions or plugin.

```javascript
import { silverHtml } from '@sika7/silver-html'
import { silverHtmlSanitize } from "@sika7/silver-html-plugin-sanitize";

const result = silverHtml("<div><p>test</p><div>test</div></div>", {}, [
silverHtmlSanitize({
  allowTags: [
    {
      tag: "div",
      allowAttrs: ["class", "style"],
      allowStyle: ["color"],
    },
  ],
})]);
console.log(result)
// # <div><div>test</div></div>
```

## config

```javascript
const plugin = {
  allowTags: [
    {
      tag: "div", // require
      allowAttrs: ["class", "style"], // options
      allowStyle: ["color"],          // options
    },
  ]
}
```

| setting    | description                                | example                | 
| ---------- | ------------------------------------------ | ---------------------- | 
| tag        | allow tag name.                            | div                    | 
| allowAttrs | allow attributes.                          | ['class','style']      | 
| allowStyle | allow styles. require style in allowAttrs. | ['color','text-align'] |

---
_Source: https://npm.io/package/@sika7/silver-html-plugin-sanitize · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
