diff --git a/site/.vitepress/config.ts b/site/.vitepress/config.ts index 9706fc4d..c43b340a 100644 --- a/site/.vitepress/config.ts +++ b/site/.vitepress/config.ts @@ -49,8 +49,8 @@ module.exports = { const pageStart = code.indexOf(""); const firstCommit = (await exec(`git log -n 1 --diff-filter=A --format="" site/${context.page}`)).stdout; const lastCommit = (await exec(`git log -n 1 --diff-filter=M --format="" site/${context.page}`)).stdout; - const header = code.slice(0, pageStart < 0 ? 0 : pageStart + 5).replace('

${header + `

${wc} words, ~${Math.round(wc / 183)} minute read. Planted ${firstCommit}.${lastCommit ? ` Last tended to ${lastCommit}.` : ''}


` + code.slice(pageStart + 5)}
`; + const header = code.slice(0, pageStart < 0 ? 0 : pageStart + 5).replace('

${wc} words, ~${Math.round(wc / 183)} minute read. Planted ${firstCommit}.${lastCommit ? ` Last tended to ${lastCommit}.` : ''}


` + code.slice(pageStart + 5).replace('', '
'); } return code; }, diff --git a/site/.vitepress/theme/Layout.vue b/site/.vitepress/theme/Layout.vue new file mode 100644 index 00000000..dfdc37bf --- /dev/null +++ b/site/.vitepress/theme/Layout.vue @@ -0,0 +1,32 @@ + + + \ No newline at end of file diff --git a/site/.vitepress/theme/index.ts b/site/.vitepress/theme/index.ts new file mode 100644 index 00000000..a30a82f8 --- /dev/null +++ b/site/.vitepress/theme/index.ts @@ -0,0 +1,7 @@ +import DefaultTheme from 'vitepress/theme'; +import Layout from './Layout.vue'; + +export default { + ...DefaultTheme, + Layout +}; diff --git a/site/.vitepress/theme/index.tsx b/site/.vitepress/theme/index.tsx deleted file mode 100644 index a00bea43..00000000 --- a/site/.vitepress/theme/index.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import DefaultTheme from 'vitepress/theme' -import { h } from "vue" -import { NolebaseHighlightTargetedHeading } from '@nolebase/vitepress-plugin-highlight-targeted-heading/client' -import '@nolebase/vitepress-plugin-highlight-targeted-heading/client/style.css' -import './custom.css' - -import fs from "fs" -import path from "path" - -import util from 'node:util' -import child_process from 'node:child_process'; -const exec = util.promisify(child_process.exec); - -export default { - ...DefaultTheme, - Layout: async () => { - const commitLink = (await exec(`git log -n 1 --format="https://code.incremental.social/thepaperpilot/pages/commit/%H"`)).stdout; - const commitTime = (await exec(`git log -n 1 --format="%ar"`)).stdout; - - return h(DefaultTheme.Layout, null, { - 'layout-top': () => [ - h(NolebaseHighlightTargetedHeading) - ], - 'layout-bottom': - }) - } -};