Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

fix(site): align star count formatting with GitHub official rounding

tianma-if82dff3fa86ec
diff --git a/apps/site/src/components/hero.astro b/apps/site/src/components/hero.astro
index 7619be10..ebf7e1cf 100644
--- a/apps/site/src/components/hero.astro
+++ b/apps/site/src/components/hero.astro
@@ -209,10 +209,17 @@ const copy = siteCopy[locale].hero;
(function () {
function formatCount(count) {
if (typeof count !== "number") return String(count);
- if (count >= 1000) {
- return (count / 1000).toFixed(1).replace(/\.0$/, "") + "k";
+ try {
+ return new Intl.NumberFormat("en", {
+ notation: "compact",
+ maximumFractionDigits: 1,
+ }).format(count).toLowerCase();
+ } catch (e) {
+ if (count >= 1000) {
+ return (Math.round(count / 100) / 10).toFixed(1).replace(/\.0$/, "") + "k";
+ }
+ return count.toLocaleString();
}
- return count.toLocaleString();
}
async function fetchGitHubStats() {