JavaScript
Switch branches/tags
Nothing to show
Clone or download
Latest commit 0b3abee Jun 6, 2017
Permalink
Failed to load latest commit information.
.gitignore ignore Jun 17, 2015
.npmignore ignore Jun 17, 2015
README.md enhancement #3 README Jun 6, 2017
index.js #6 rm use strict Jun 6, 2017
package.json #6 rm use strict Jun 6, 2017

README.md

Hexo-WordCount

npm npm npm

Installation

yarn add hexo-wordcount
# or
npm i --save hexo-wordcount
# Node 版本7.6.0之前,请安装 2.x 版本 (Node.js v7.6.0 and previous)
npm install hexo-wordcount@2 --save

Usage

字数统计 WordCount

wordcount(post.content)

阅读时长预计 Min2Read

min2read(post.content)

设置阅读速度 Set Reading Speed:

min2read(post.content, {cn: 300, en: 160})
// p.s. (v3.0.0 added)

总字数统计 TotalCount

totalcount(site, '0,0.0a')

第二个参数为可选参数,表示字数显示的 format,文档参考:http://numeraljs.com/

Demo

Swig

Post Count:

   <span class="post-count">{{ wordcount(post.content) }}</span>

Post Minutes to Read:

   <span class="post-count">{{ min2read(post.content) }}</span>

Total Count:

   <span class="post-count">{{ totalcount(site, '0,0.0a') }}</span>

Second param format optional.

Ejs

Post Count:

   <span class="post-count"><%= wordcount(post.content) %></span>

Post Minutes to Read:

   <span class="post-count"><%= min2read(post.content) %></span>

Total Count:

   <span class="post-count"><%= totalcount(site) %></span>

Jade

Post Count:

   span.post-count= wordcount(post.content)

Post Minutes to Read:

    span.post-count= min2read(post.content)

Total Count:

   span.post-count= totalcount(site)

Contributors

 project  : hexo-wordcount
 repo age : 12 months
 active   : 5 days
 commits  : 8
 files    : 5
 authors  :
     8  Willin Wang  100.0%

LICENSE

MIT

Alipay Donation(通过支付宝捐赠):

qr