Skip to content

Latest commit

 

History

History
31 lines (19 loc) · 971 Bytes

README.md

File metadata and controls

31 lines (19 loc) · 971 Bytes

Codeship Status for ntslive/text-sanitizer

NTS Text Sanitizer

Text Sanitizer used by NTS in their Node.js applications. Sanitizes text blocks, including removal of HTML tags (excluding whitelisted tags) and transformation of Markdown into HTML.

Installation

Include as dependency in package.json:

"text-sanitizer": "github:ntslive/text-sanitizer#0.0.4"

Note that this requires the Git tag 0.0.4 to be present.

Then run npm install as usual.

Usage

const textSanitizer = require('text-sanitizer');
let plainTextName = textSanitizer.stripMarkdownTags(obj.name);
let descriptionHtml = textSanitizer.sanitizeText(obj.description);
let excerpt = textSanitizer.createExcerpt(obj.description);

Testing

Run npm test

To run eslint with fix flag, run bin/eslint