trunkata

Truncation utility which preserves HTML content and can truncate by lines.

Usage no npm install needed!

<script type="module">
  import trunkata from 'https://cdn.skypack.dev/trunkata';
</script>

README

trunkata Donate on Gittip

Truncation utility which preserves HTML tags and content.

This library was created to solve truncating HTML at line breaks rather than at a character index or word. Line breaks are preferred due to the inconsistency of font sizes between browsers.

Getting Started

Install the module with: npm install trunkata

var trunkata = require('trunkata');
trunkata.awesome(); // "awesome"

Documentation

(Coming soon)

Examples

(Coming soon)

Development

Use livereload, listen-spawn -- npm run pretest, and serve. Then, navigate to http://localhost:3000/test/trunkata_test.html

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint via grunt and test via npm test.

License

Copyright (c) 2013 Todd Wolfson

Licensed under the MIT license.