/hexo-reading-helper

Hexo helper plugin for getting word count & estimated reading time

Primary LanguageJavaScriptMIT LicenseMIT

hexo-reading-helper

Hexo helper plugin for getting word count & estimated reading time

Package version Downloads Standard Travis Build Standard Readme GitHub version Dependency CI License PRs Donate

Github Watch Badge Github Star Badge Tweet

Built with ❤︎ by Tiaan and contributors

Table of Contents

Table of Contents
  • Install
  • Usage
  • Contribute
  • License
  • Install

    $ npm install --save hexo-reading-helper
    # OR
    $ yarn add hexo-reading-helper

    Usage

    Usage shown using ejs

    To get reading time:

    <%- reading(page.content).time() %> <!-- 1 min read -->

    To get word count:

    <%- reading(page.content).words() %> <!-- 50 words -->

    Use your own custom formatting by passing a callback to the time or words function:

    <%- reading(page.content).time(function(minutes) {
    	return 'About ' + minutes + 'min'
    }) %> <!-- 1 min read -->

    Set the number of words per a minute to base estimation on:

    <%- reading(page.content, {wordsPerMinute: 400}).time() %>

    Contribute

    Contributions are welcome. Please open up an issue or create PR if you would like to help out.

    Note: If editing the README, please conform to the standard-readme specification.

    License

    Licensed under the MIT License.