fix: refine anchor extraction and changelog dates

This commit is contained in:
Justineo
2022-01-19 14:21:05 +08:00
parent 67ab3454ef
commit 9f5d731b68
3 changed files with 26 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
import visit from 'unist-util-visit'
import { upperFirst } from './util'
const KNOWN_SCOPES_CONFIG = {
props: '属性',
@@ -13,7 +14,7 @@ const KNOWN_SCOPES_CONFIG = {
}
const KNOWN_SCOPES = Object.entries(KNOWN_SCOPES_CONFIG).reduce(
(acc, [key, value]) => {
acc[key] = key
acc[upperFirst(key)] = key
acc[value] = key
return acc
},

View File

@@ -27,3 +27,10 @@ export function hash (path) {
hash.update(path)
return hash.digest('hex').substring(0, 7)
}
export function upperFirst (str) {
if (str.length === 0) {
return str
}
return str[0].toUpperCase() + str.slice(1)
}