diff --git a/package.json b/package.json index 4d8098d0253..38ca75bee90 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ }, "keywords": [], "devDependencies": { + "@uiw/formatter": "^1.3.3", "@wcj/markdown-to-html": "^2.1.2", "chokidar": "^3.5.3", "fs-extra": "^10.1.0", diff --git a/scripts/create.mjs b/scripts/create.mjs index 00059f8f1af..fd3b0e7ff63 100644 --- a/scripts/create.mjs +++ b/scripts/create.mjs @@ -81,7 +81,7 @@ export function create(str = '', options = {}) { node.children = tocsData; } node.children.unshift(header(options)); - node.children.push(footer()); + node.children.push(footer(options)); node.children.push(anchorPoint()); } } diff --git a/scripts/nodes/footer.mjs b/scripts/nodes/footer.mjs index 19f943a8240..a76cb9a69b1 100644 --- a/scripts/nodes/footer.mjs +++ b/scripts/nodes/footer.mjs @@ -1,5 +1,10 @@ +import formatter from '@uiw/formatter'; -export function footer() { +export function footer(options = {}) { + const footerText = '© 2022 Kenny Wang.'; + if (options.isHome) { + footerText += ` Updated on ${formatter('YYYY/MM/DD HH:mm:ss', new Date())}`; + } return { type: 'element', tagName: 'footer', @@ -13,10 +18,8 @@ export function footer() { properties: { class: ['max-container'], }, - children: [ - { type: 'text', value: '© 2022 Kenny Wang, All rights reserved.' } - ], - } + children: [{ type: 'text', value: footerText }], + }, ], }; } diff --git a/scripts/style/style.css b/scripts/style/style.css index 3e6a27787ee..2676f2e9efa 100644 --- a/scripts/style/style.css +++ b/scripts/style/style.css @@ -1196,6 +1196,7 @@ body:not(.home) .h2wrap-body > .wrap:hover .h3wrap > h3 a::after { color: rgb(100 116 139/1); background-color: var(--color-canvas-subtle); text-align: center; + font-size: 0.75rem; } @media (min-width: 1024px) {