fix: refine anchor extraction and changelog dates
This commit is contained in:
parent
67ab3454ef
commit
9f5d731b68
@ -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
|
||||
},
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -90,7 +90,10 @@
|
||||
<nuxt-link
|
||||
:to="`#${getHash(version)}`"
|
||||
>
|
||||
{{ version }}<small v-if="codeName">{{ codeName }}</small><small v-if="date">{{ date }}</small>
|
||||
{{ version }}<small v-if="codeName">{{ codeName }}</small><time
|
||||
v-if="date"
|
||||
:datetime="date"
|
||||
>{{ date }}</time>
|
||||
</nuxt-link>
|
||||
</h2>
|
||||
<ul class="changeset">
|
||||
@ -300,8 +303,11 @@ h2
|
||||
color #333 !important
|
||||
|
||||
small
|
||||
time
|
||||
display inline-flex
|
||||
align-items center
|
||||
|
||||
small
|
||||
font-size 14px
|
||||
|
||||
&::before
|
||||
@ -309,6 +315,16 @@ h2
|
||||
font-size 20px
|
||||
margin 0 8px
|
||||
|
||||
time
|
||||
font-size 12px
|
||||
color #999
|
||||
|
||||
&::before
|
||||
content "/"
|
||||
font-size 10px
|
||||
margin 0 8px
|
||||
color #ccc
|
||||
|
||||
.changeset
|
||||
list-style-type none
|
||||
padding-left 0
|
||||
|
Loading…
Reference in New Issue
Block a user