An open API service indexing awesome lists of open source software.

https://github.com/rcasto/readability-component

A web component that calculates the readability and average reading time of text it encapsulates
https://github.com/rcasto/readability-component

readability readability-level web-component

Last synced: 4 months ago
JSON representation

A web component that calculates the readability and average reading time of text it encapsulates

Awesome Lists containing this project

README

          

# Readability Web Component
A web component that can be used to wrap around your text content and determine its readability level, as well as the average time it would take to read.

To determine the readability level the [Flesch Kincaid readability test](https://en.wikipedia.org/wiki/Flesch%E2%80%93Kincaid_readability_tests) is used.

To determine the average time to read the content, an average reading speed of 180 words per minute is used.

**Note:** A heuristic is utilized to determine the number of syllables in a word, so the readability level may not be exactly what it would be if you were to manually calculate it, but it should not be terribly far off.

[Try it out! (codepen)](https://codepen.io/rcasto/pen/gOaxjKM)

## Usage

### Via script tag
```html



Readability Web Component

read-ability {
/* Allow customization of some of the Web components styling via
CSS properties */
--readability-margin: 0 0 16px 0;
--readability-font-size: 0.8em;
--readability-font-weight: lighter;
--readability-opacity: 0.8;
--readability-spacer-margin: 0 6px;
--readability-justify-content: center;
}







```

### Via module bundler
1. Install package via package manager of your choice.
```
npm install readability-component
```

2. `import 'readability-component'` as part of your app module, it should then be included as part of your bundle.
```javascript
import 'readability-component';

// Rest of your code...
```

3. You can now use `` in your app views!

## Resources
- https://www.howmanysyllables.com/howtocountsyllables
- https://en.wikipedia.org/wiki/Flesch%E2%80%93Kincaid_readability_tests#Flesch%E2%80%93Kincaid_grade_level
- https://en.wikipedia.org/wiki/Words_per_minute#Reading_and_comprehension