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

datocms-plugin-word-counter

v1.6.0

Published

A plugin for DatoCMS that gives info for text and string fields about word count

Downloads

36

Readme

DatoCMS plugin: Word counter

This DatoCMS plugin gives you information for text and string fields about word count, character count, sentences, paragraphs, reading time and common words.

Features

  • Add to structured-text, string and text fields or your own selection of these fields.
  • See count of words, characters, sentences, paragraphs
  • See an estimate of the reading time
  • See common words
  • Full control over the visible calculations
  • Be able to choose to add spaces and enters in the calculations
  • Expose the count and use it from the API

Configuration

First add this plugin via DatoCMS Settings > Plugins > Add (/admin/plugins/new).

Plugin settings

For this plugin you can configure global settings and configure the plugin per field. Choose to apply the plugin automatically to all string/text fields or add the plugin as addon per model/field. Settings set per model/field will always overwrite all global settings.

Global Settings

  • Auto apply to fields (switch): When enabled this will automatically apply the plugin to all structured-text, string and text fields. By changing the following setting you can choose on which fields this plugin will be applied.

  • Field where this plugin is enabled (multi select): You can choose to which fields the plugin will be applied.

Options of Field where this plugin is enabled:

  • Structured-text fields
  • String fields
  • text fields

General Settings

  • Calculations to show (multi select): You can choose which calculations will be shown. As default all calculations will be shown. When no calculations are selected the plugin will only show word count on the applied fields.

Options of Calculations to show:

  • Number of characters
  • Number of special characters
  • Number of sentences
  • Number of paragraphs
  • Reading time
  • Show common words
  • Include space (select): You can choose if spaces and enters are taken into account in the calculations shown in the plugin. The default Show switch to toggle spaces will show a switch to let the user choose themselves.

Options of Include space:

  • Show switch to toggle spaces
  • Always include spaces
  • Never include spaces
  • Include HMTL elements (select): You can choose if html elements are taken into account in the calculations shown in the plugin. The default Show switch to toggle HTML elements will show a switch to let the user choose themselves.

Options of Include HTML elements:

  • Show switch to HTML elements
  • Always include HTML elements
  • Never include HTML elements

Expose word count

With this word counter plugin you can expose the word count results in the API. To do this you have to specify a new field in the model where the word counter is implemented. The field that is added will automatically be hidden, but will still be exposed in the API.

  • Exposed word counter field id (text): You can use the id of a specific JSON field or leave this blank which will automatically use '{fieldId}_word_counter'

The field where the stats are being saved has to be a JSON field and make sure the ID isn't used in other fields

Implementing it like the screenshot will result in:

{
  "data": {
    "wordCounterPage": {
      "title": "Page title",
      "titleWordCounter": {
        "words": 2,
        "characters": 10,
        "specialCharacters": 1,
        "sentences": 1,
        "paragraphs": 1,
        "commonWords": {
          "page": 1,
          "title": 1
        },
        "readingTime": "< 1 second",
        "settings": {
          "includeSpace": true,
          "includeHTML": true
        }
      }
    }
  }
}

Contributing

See contributing.md.