https://github.com/d-e-v-s-k/cuttr-js
Cuttr is a javascript plugin that truncates multi-line text content with multiple truncation methods and custom ellipsis.
https://github.com/d-e-v-s-k/cuttr-js
content cuttr dotdotdot ellipsis javascript jquery line line-clamp line-clamping multi multi-line-text multiline shorten text text-overflow truncate truncate-text truncation
Last synced: 16 days ago
JSON representation
Cuttr is a javascript plugin that truncates multi-line text content with multiple truncation methods and custom ellipsis.
- Host: GitHub
- URL: https://github.com/d-e-v-s-k/cuttr-js
- Owner: d-e-v-s-k
- License: gpl-3.0
- Created: 2020-07-31T13:05:59.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-09T11:12:24.000Z (over 3 years ago)
- Last Synced: 2026-03-04T05:48:31.899Z (3 months ago)
- Topics: content, cuttr, dotdotdot, ellipsis, javascript, jquery, line, line-clamp, line-clamping, multi, multi-line-text, multiline, shorten, text, text-overflow, truncate, truncate-text, truncation
- Language: JavaScript
- Homepage: https://cuttr.kulahs.de/
- Size: 227 KB
- Stars: 43
- Watchers: 2
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cuttr.js

Cuttr is a zero dependency, easy to use JS / jQuery library that truncates multiple line text content (Line Clampin’) to fit within given specifications. It adds an ending string like a ellipsis (...) to indicate that there is more text available than currently visible.
* Multiple truncation methods
* Truncate text without breaking the HTML
* Custom ellipsis strings
* Optional "Read more" anchor to expand original content
[Demos online](https://cuttr.kulahs.de/examples.html) | [Codepen Example](https://codepen.io/herkulas/pen/xxZNXGv)
---
Overview
- [Install](https://github.com/d-e-v-s-k/cuttr-js#install)
- [License](https://github.com/d-e-v-s-k/cuttr-js#license)
- [Usage](https://github.com/d-e-v-s-k/cuttr-js#usage)
- [Options](https://github.com/d-e-v-s-k/cuttr-js#options)
- [Methods](https://github.com/d-e-v-s-k/cuttr-js#methods)
- [Callbacks](https://github.com/d-e-v-s-k/cuttr-js#callbacks)
- [Examples](https://github.com/d-e-v-s-k/cuttr-js#demos--examples)
## Install
### Download
- [cuttr.min.js](https://unpkg.com/cuttr@1/dist/cuttr.min.js) minified, or
- [cuttr.js](https://unpkg.com/cuttr@1/dist/cuttr.js) un-minified
### CDN
Link directly to Cuttr files on [unpkg](https://unpkg.com/cuttr).
``` html
```
Link directly to Cuttr files on [cdnjs](https://cdnjs.com/libraries/cuttr).
``` html
```
### Package managers
npm
```sh
npm install cuttr -D
```
yarn
```sh
yarn add cuttr -D
```
bower
```sh
bower install d-e-v-s-k/cuttr-js --save
```
## License
### Commercial license
If you want to use Cuttr to develop commercial sites, themes, projects, and applications, the Commercial license is the appropriate license. With this option, your source code is kept proprietary. [[Purchase a Cuttr Commercial License]](https://cuttr.kulahs.de)
### Open source license
If you are creating an open source application under a license compatible with the [GNU GPL license v3](https://www.gnu.org/licenses/gpl-3.0.html), you may use Cuttr under the terms of the GPLv3.
The credit comments in the JavaScript files should be kept intact (even after combination or minification).
[Read more about Cuttr's licenses](https://cuttr.kulahs.de/pricing.html).
## Usage
As you can see in the example files, you will need to include:
- The JavaScript file `cuttr.js` (or its minified version `cuttr.min.js`)
### Including files:
```html
```
Or as a module
```sh
import Cuttr from 'Cuttr';
```
### Initialization
#### Initialization with Vanilla Javascript
All you need to do is call cuttr.js before the closing `