npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

readability-component

v1.0.10

Published

This is a fairly simple web component that can be used to wrap around your content and determine its readability level, as well as the average time it would take to read.

Downloads

14

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 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)

Usage

Via script tag

<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Readability Web Component</title>
  <style>
    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;
    }
  </style>
</head>
<body>
  <read-ability>
    <!-- This can be anything, this is your content -->
    <!-- Make sure to add slot="readable-text" attribute to your content if you also want it to be rendered -->
    <!-- If you neglect to add the slot, then the readability of any text contained by the component is computed, without displaying it -->
    <div id="text-content" slot="readable-text"></div>
  </read-ability>

  <!-- Include script on your page -->
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/readability.min.js"></script>
</body>
</html>

Via module bundler

  1. Install package via package manager of your choice.
npm install readability-component
  1. import 'readability-component' as part of your app module, it should then be included as part of your bundle.
import 'readability-component';

// Rest of your code...
  1. You can now use <read-ability></read-ability> 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