From 9f5d731b68f9c437e33e3940cb4a46766f4eb51a Mon Sep 17 00:00:00 2001 From: Justineo Date: Wed, 19 Jan 2022 14:21:05 +0800 Subject: [PATCH] fix: refine anchor extraction and changelog dates --- one/build/remark-anchor.js | 3 ++- one/build/util.js | 7 +++++++ one/docs/changelog.vue | 18 +++++++++++++++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/one/build/remark-anchor.js b/one/build/remark-anchor.js index 38f215f..4f82f7e 100644 --- a/one/build/remark-anchor.js +++ b/one/build/remark-anchor.js @@ -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 }, diff --git a/one/build/util.js b/one/build/util.js index 19c6df2..11bdd05 100644 --- a/one/build/util.js +++ b/one/build/util.js @@ -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) +} diff --git a/one/docs/changelog.vue b/one/docs/changelog.vue index 6a4bbaf..92a1ba9 100644 --- a/one/docs/changelog.vue +++ b/one/docs/changelog.vue @@ -90,7 +90,10 @@ - {{ version }}{{ codeName }}{{ date }} + {{ version }}{{ codeName }}