docsify-enhanced-word-count
English | 中文
This is a plugin to enhance docsify-count plugin.
What Problem to Solve
Plugin docsify-count is a quite good plugin that provides for counting words in the article. However, it has a bad support for i18n localization as it can only set one language at the same time. As a result, if you have multiple languages in one docsify document, you can't set the displayed word/minute separately.
After Using This Plugin
This plugin adds i18n localization support for docsify-count.
To Use
In index.html
, add:
<!-- docsify-enhanced-word-count plugin -->
<script src="https://cdn.jsdelivr.net/gh/pikapikapikaori/docsify-enhanced-word-count@latest/src/countWords.js"></script>
Add settings:
window.$docsify = {
ountWords: {
countable: true,
position: "top",
margin: "10px",
float: "right",
fontsize: "0.9em",
color: "rgb(90,90,90)",
localization: {
words: {
'/zh-cn/': '字',
'/': 'words'
},
minute: {
'/zh-cn/': '分钟',
'/': 'min'
},
},
// Or
// localization: {
// word: 'words',
// minute: 'min'
// }
isExpected: true,
},
}
Attribute | Type | Description | Value |
---|---|---|---|
countable | Boolean | Set whether to use this plugin | true(Default) / false |
position | String | Set display position | 'top'(Default) / 'bottom' |
margin | String | Set margin to the near DOM element | '10px' |
float | String | Set alignment | 'right'(Default) / 'top' |
fontsize | String | Set font size | '0.9em' |
color | String | Set color | 'rgb(90,90,90)' |
localization | Object | Support localization | |
isExpected | Boolean | Set whether to display reading time | true(Default) / false |
Related Reference
Demo
Others
It's welcomed to make pr to this repo in order to improve this plugin.
If you like this plugin, please give a star, thanks!
For more tools I developed please refer to my blog.