cc-text-utils

Text Utilities for ClassicCars.com

Usage no npm install needed!

<script type="module">
  import ccTextUtils from 'https://cdn.skypack.dev/cc-text-utils';
</script>

README

cc-text-utils

ClassicCars.com Text Utilities - Input Cleanup and Filtering

convert

`var convert = require('cc-text-utils').convert;

toMarkdown

Sanitize Markdown & HTML input and convert to a filtered markdown syntax.

convert.toMarkdown(inputText, options)

options: (optional object)

  • tables (optional Boolean=false) - if set to a truthy value will allow tables as valid tags (these are left in as-is, and isn't well tested)

fromMarkdown

Converts markdown to a sanitized HTML output.

convert.fromMarkdown(inputMarkdown, options)

options: (optional object)

  • nofollow (optional Boolean = false) - when set to a truthy value will add `rel="nofollow" to anchor tags.

toCleanHtml

convert.toCleanHtml(input, options)

Will run the text through fromMarkdown(toMarkdown(input, options), options) effectively sanitizing user description input.

marked

var marked = require('cc-text-utils').marked;

Exposes marked npm package.

to-markdown

var toMarkdown = require('cc-text-utils')['to-markdown'];

Exposes to-markdown npm package

sanitize-html

var sanitize = require('cc-text-utils')['sanitize-html'];

Exposes sanitize-html npm package

Buffer

var Buffer = require('cc-text-utils').Buffer;

Exposes Buffer implementation (mainly for browserified version.