hexo/node_modules/hexo-theme-butterfly/scripts/events/comment.js

15 lines
421 B
JavaScript
Raw Normal View History

2023-10-03 11:14:36 +08:00
/**
* Capitalize the first letter of comment name
*/
hexo.extend.filter.register('before_generate', () => {
const themeConfig = hexo.theme.config
let { use } = themeConfig.comments
if (!use) return
if (typeof use === 'string') {
use = use.split(',')
}
const newArray = use.map(item => item.toLowerCase().replace(/\b[a-z]/g, s => s.toUpperCase()))
themeConfig.comments.use = newArray
})