代码拉取完成,页面将自动刷新
同步操作将从 Snow社区/dingflow-docsify 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
//default values
var defaultOptions = {
countable: true,
position: "top",
margin: "10px",
float: "right",
fontsize: "0.9em",
color: "rgb(90,90,90)",
language: "english",
isExpected: true,
}
// Docsify plugin functions
function plugin(hook, vm) {
if (!defaultOptions.countable) {
return
}
let wordsCount
hook.beforeEach(function (content) {
// Match regex every time you start parsing .md
wordsCount = content.match(/([\u4e00-\u9fa5]+?|[a-zA-Z0-9]+)/g).length
return content
})
hook.afterEach(function (html, next) {
let str = wordsCount + " words"
let readTime = Math.ceil(wordsCount / 400) + " min"
//Determine whether to use the Chinese style according to the attribute "language"
if (defaultOptions.language === "chinese") {
str = wordsCount + " 字"
readTime = Math.ceil(wordsCount / 400) + " 分钟"
}
//add html string
next(
`
${defaultOptions.position === "bottom" ? html : ""}
<div style="margin-${defaultOptions.position ? "bottom" : "top"}: ${
defaultOptions.margin
};">
<span style="
float: ${defaultOptions.float === "right" ? "right" : "left"};
font-size: ${defaultOptions.fontsize};
color:${defaultOptions.color};">
${str}
${defaultOptions.isExpected ? ` | ${readTime}` : ""}
</span>
<div style="clear: both"></div>
</div>
${defaultOptions.position !== "bottom" ? html : ""}
`
)
})
}
// Docsify plugin options
window.$docsify["count"] = Object.assign(
defaultOptions,
window.$docsify["count"]
)
window.$docsify.plugins = [].concat(plugin, window.$docsify.plugins)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。