Repository navigation
Fonts
PDF and HTML use different font mechanisms. Leafmark's fonts config supports system font names, local font files, CSS, and custom LaTeX includes.
XeLaTeX can load installed font families:
{
"fonts": {
"pdf": "Aptos",
"mono": "JetBrains Mono"
}
}If XeLaTeX is unavailable and Leafmark falls back to pdfLaTeX, system-font behavior is more limited. Install XeLaTeX for predictable custom font support.
{
"fonts": {
"pdfFiles": {
"path": "fonts",
"upright": "Inter-Regular.ttf",
"bold": "Inter-Bold.ttf",
"italic": "Inter-Italic.ttf",
"boldItalic": "Inter-BoldItalic.ttf",
"scale": 1
},
"monoFiles": {
"path": "fonts",
"upright": "JetBrainsMono-Regular.ttf",
"bold": "JetBrainsMono-Bold.ttf",
"scale": 0.9
}
}
}upright is required for each file mapping. Other faces and scale are optional. Every configured file must exist.
{
"fonts": {
"css": ["fonts/web.css"]
}
}Example fonts/web.css:
@font-face {
font-family: "Inter";
src: url("Inter-Regular.ttf") format("truetype");
font-weight: 400;
font-style: normal;
}
body {
font-family: "Inter", sans-serif;
}These stylesheets are added to HTML output. For HTML blocks rendered into PDF/DOCX images, include the relevant file in frontmatter styles as well if it is not already imported by a component stylesheet.
{
"fonts": {
"latexInclude": "fonts/custom-fonts.tex"
}
}Leafmark inserts an \input{...} for the file into its generated font snippet. Use it for advanced fontspec setup or related typography packages.
Without configured fonts, Leafmark tries TeX Gyre Heros and TeX Gyre Cursor. If the Heros OpenType file is unavailable in the TeX installation, it falls back to the Helvetica package and a sans-serif family.
Theme font paths point to installed locations under .leafmark/theme/. A theme can bundle physical font files, CSS @font-face declarations, and LaTeX includes. See Themes.
- Run
pnpx @skxv/leafmark doctorand confirm a LaTeX engine exists. - Verify spelling and capitalization of system font family names.
- Ensure all file paths are project-relative and all configured variants exist.
- Use
--keep-build-filesand inspect_pandoc-fonts.tex. - Confirm CSS font URLs are relative to the CSS file and included in standalone HTML.
Leafmark documentation · Source repository · npm
Leafmark Wiki
Authoring
Configuration
Building
Help