diff --git a/docs/package.json b/docs/package.json
index 5e224ff1..36addee5 100644
--- a/docs/package.json
+++ b/docs/package.json
@@ -5,12 +5,15 @@
"docs:preview": "vitepress preview build/.documenter"
},
"devDependencies": {
+ "@types/d3-format": "^3.0.4",
+ "@types/node": "^22.10.1",
"markdown-it-mathjax3": "^4.3.2",
"rollup-plugin-delete": "^2.0.0",
- "vitepress": "^1.3.4",
+ "vitepress": "^1.5.0",
"vitepress-plugin-tabs": "^0.5.0"
},
"dependencies": {
+ "d3-format": "^3.1.0",
"markdown-it": "^14.1.0",
"markdown-it-footnote": "^4.0.0"
}
diff --git a/docs/src/.vitepress/config.mts b/docs/src/.vitepress/config.mts
index 3cb2a7c7..d9016dab 100644
--- a/docs/src/.vitepress/config.mts
+++ b/docs/src/.vitepress/config.mts
@@ -155,7 +155,7 @@ export default defineConfig({
pattern: 'https://github.com/JuliaDataCubes/YAXArrays.jl/edit/master/docs/src/:path'
},
socialLinks: [
- { icon: 'github', link: 'https://github.com/JuliaDataCubes/YAXArrays.jl' }
+ // { icon: 'github', link: 'https://github.com/JuliaDataCubes/YAXArrays.jl' }
],
footer: {
message: 'Made with DocumenterVitepress.jl',
diff --git a/docs/src/.vitepress/theme/index.ts b/docs/src/.vitepress/theme/index.ts
index a689558a..c92e1d32 100644
--- a/docs/src/.vitepress/theme/index.ts
+++ b/docs/src/.vitepress/theme/index.ts
@@ -3,7 +3,8 @@ import { h } from 'vue'
import type { Theme } from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import AsideTrustees from '../../components/AsideTrustees.vue'
-import VersionPicker from "./VersionPicker.vue"
+import VersionPicker from "../../components/VersionPicker.vue"
+import StarUs from '../../components/StarUs.vue'
import { enhanceAppWithTabs } from 'vitepress-plugin-tabs/client'
import './style.css'
@@ -13,6 +14,7 @@ export default {
Layout() {
return h(DefaultTheme.Layout, null, {
'aside-ads-before': () => h(AsideTrustees),
+ 'nav-bar-content-after': () => h(StarUs),
})
},
enhanceApp({ app, router, siteData }) {
diff --git a/docs/src/components/StarUs.vue b/docs/src/components/StarUs.vue
new file mode 100644
index 00000000..52ae59ea
--- /dev/null
+++ b/docs/src/components/StarUs.vue
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+ {{ formattedStarCount }}
+
+
+
+
+
+
+
diff --git a/docs/src/.vitepress/theme/VersionPicker.vue b/docs/src/components/VersionPicker.vue
similarity index 100%
rename from docs/src/.vitepress/theme/VersionPicker.vue
rename to docs/src/components/VersionPicker.vue
diff --git a/docs/src/components/stargazers.data.ts b/docs/src/components/stargazers.data.ts
new file mode 100644
index 00000000..cc9c0186
--- /dev/null
+++ b/docs/src/components/stargazers.data.ts
@@ -0,0 +1,28 @@
+const REPO = "JuliaDataCubes/YAXArrays.jl";
+
+export default {
+ async load() {
+ let stargazers_count;
+ try {
+ ({stargazers_count} = await github(`/repos/${REPO}`));
+ } catch (error) {
+ if (process.env.CI) throw error;
+ stargazers_count = NaN;
+ }
+ return stargazers_count;
+ }
+};
+
+async function github(
+ path,
+ {
+ authorization = process.env.GITHUB_TOKEN && `token ${process.env.GITHUB_TOKEN}`,
+ accept = "application/vnd.github.v3+json"
+ } = {}
+) {
+ const url = new URL(path, "https://api.github.com");
+ const headers = {...(authorization && {authorization}), accept};
+ const response = await fetch(url, {headers});
+ if (!response.ok) throw new Error(`fetch error: ${response.status} ${url}`);
+ return await response.json();
+}