Warning
This project is for personal use only. It is designed as a lightweight tool for self-hosting fonts and may not strictly comply with the specific technical specifications or licensing restrictions of Google Fonts, Apple (Typekit), or other providers.
Commercial use is strictly prohibited. Use at your own risk.
MkDocs Fontkit is a precision font builder that allows you to self-host Adobe Fonts (Typekit), Google Fonts, and local offline fonts with minimal overhead. It uses advanced static analysis to extract font metadata and construction logic without relying on heavyweight browser automation.
- Typekit Static Analysis: Ported Typekit URL generation logic (Bloom filters, hashing) to download WOFF2 files directly without Puppeteer/Playwright.
- Google Fonts Downloader: Automatically fetches Google Webfonts, downloads assets locally, and rewrites CSS.
- Offline Font Splinter: Integrates
cn-font-splitto optimize large custom fonts (CJK, Latin Modern, etc.) into chunks. - Production Ready: Outputs both
fonts.cssand a minified, comment-freefonts.min.css. - Zero Browser Dependencies: Fast, lightweight, and works in restricted environments.
npm install -g mkdocs-fontkitOr clone and use locally:
git clone https://github.com/mkdocs/mkdocs-fontkit.git
cd mkdocs-fontkit
npm installCreate a fontkit.config.json in your project root:
{
"typekit": ["your-kit-id"],
"google": [
"Inter:wght@400..700",
"Fira+Code"
],
"offline": [
{
"file": "my-local-font.otf",
"family": "CustomSans",
"weight": "400",
"style": "normal"
}
]
}Run the build script:
npm run buildThe output will be generated in the dist/ directory:
dist/fonts.css: Readable CSS.dist/fonts.min.css: Minified CSS for production.dist/fonts/: Downloaded font assets.
This project is primarily maintained for personal use and I do not expect major feature contributions. However, bug reports and small corrections are always welcome.
This file was generated by Gemini 3 Flash (Antigravity AI) following the instructions of the project owner. The content has been reviewed and verified by a human.