# mongoose-html

> Adds schema type "html" to mongoose to provie sanitized html.

Latest version **0.0.1** (published 2014-11-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install mongoose-html
pnpm add mongoose-html
yarn add mongoose-html
bun add mongoose-html
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2014-11-25 |
| First published | 2014-11-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+8 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Homer Quan |
| Maintainers | homerquan |
| Keywords | mongoose, sanitize-html |

## Links

- npm: https://www.npmjs.com/package/mongoose-html
- Repository: https://github.com/homerquan/mongoose-html
- Issues: https://github.com/homerquan/mongoose-html/issues
- npm.io page: https://npm.io/package/mongoose-html

## Dependencies (1)

- [sanitize-html](https://npm.io/package/sanitize-html.md) ^1.4.3

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [mongoose-typescript](https://npm.io/package/mongoose-typescript.md) — 85 weekly downloads

## Recent versions

- 0.0.1 (latest) — 2014-11-25

## README

## What it does

* Saves a String as an sanitized html (remove js and css, limit tags...). For more details about sanitized html, check https://github.com/punkave/sanitize-html

## How to use

```JavaScript
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
// Will add the Currency type to the Mongoose Schema types
require('mongoose-html').loadType(mongoose);
var Html = mongoose.Types.Html;

// If you don't have the Html variable declared you can use 'mongoose.Types.Html'
var ContentSchema = Schema({
  richContent: {
    type: Html,
    setting: {
      allowedTags: ['p', 'b', 'i', 'em', 'strong', 'a'],
      allowedAttributes: {
        'a': ['href']
      }
    }
  }
});

var Content = mongoose.model('Content', ContentSchema);

var content = new Content({ richContent: "<a href='http://google.com' style='display:block'>google</a>" });

```
### Schema options
Same as sanitize-html https://github.com/punkave/sanitize-html


### About author
Created by [Homer Quan](http://homerquan.com) for [reflen.com](http://www.reflen.com)

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