Symbols count and time to read of articles plugin for Hexo.
Switch branches/tags
Clone or download
Latest commit 126276f Jun 26, 2018

README.md

hexo-symbols-count-time

cover-image travis-image appveyor-image hexo-image node-image npm-image mnt-image lic-image

Symbols count and time to read of articles.

Better than hexo-reading-time and faster than hexo-worcount. No external dependencies.

Installation

size-image dm-image dt-image

$ npm install hexo-symbols-count-time --save

Usage

Activate this plugin in hexo's _config.yml (which locates in the root dir of your blog) by enabled any option:

symbols_count_time:
  symbols: true
  time: true
  total_symbols: true
  total_time: true

If symbols_count_time not specified (or commented), plugin will totally disabled.

NexT theme

This plugin integrated in «NexT» and after plugin enabled in main Hexo config, you may adjust options in NexT config:

symbols_count_time:
  separated_meta: true
  item_text_post: true
  item_text_total: false
  awl: 4
  wpm: 275

Parameters

  • AWL — Average Word Length (chars count in word). Default: 4. You can check this here.
    • CN ≈ 2
    • EN ≈ 5
    • RU ≈ 6
  • WPM — Words Per Minute. Default: 275. You can check this here.
    • Slow ≈ 200
    • Normal ≈ 275
    • Fast ≈ 350
  • Suffix — If time to read less then 60 minutes, added suffix as string parameter. Default: mins.

Note for Chinese users: because in Chinese language average word length about ~1.5 and if you at most cases write posts in Chinese (without mixed English), recommended to set awl to 2 and wpm to 300.
But if you usualy mix your posts with English, awl to 4 and wpm to 275 will be nice.

Development

$ cd hexo
$ git clone https://github.com/theme-next/hexo-symbols-count-time.git node_modules/hexo-symbols-count-time
$ cd node_modules/hexo-symbols-count-time

Tests

$ npm install mocha chai --save-dev
$ npm test

Tests with coverage

$ npm install -g istanbul
$ istanbul cover --print both node_modules/.bin/_mocha -- test/index.js

Templates

Symbols Count

{{ symbolsCount(post.content) }}

Symbols Time

{{ symbolsTime(post.content) }}

Or with predefined parameters:

{{ symbolsTime(post.content, AWL, WPM, Suffix) }}

Symbols Count Total

{{ symbolsCountTotal(site) }}

Symbols Time Total

{{ symbolsTimeTotal(site) }}

Or with predefined parameters:

{{ symbolsTimeTotal(site, AWL, WPM, Suffix) }}

Renderers syntax

SWIG / Nunjucks: {{ template }}
EJS: <%- template %>
Jade: span= template