You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
407 B
15 lines
407 B
9 months ago
|
/**
|
||
|
* 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
|
||
|
})
|