Documentation¶
This project's documentation site is built with Zensical and hosted on GitHub Pages at jjeff07.github.io/libreclient.
How It Works¶
The docs follow a single source of truth philosophy — content is written once in the project root
(README.md, CONTRIBUTING.md, COMMIT_TYPES.md) and pulled into the docs site at build time using
a macros plugin. This means the repo-level docs and the website are always in sync.
Architecture¶
Project Root Docs Site
───────────── ─────────
README.md ──┐
CONTRIBUTING.md ──┼──▶ scripts/zensical_macros.py ──▶ docs/*.md ──▶ Built Site
COMMIT_TYPES.md ──┘
Key Files¶
| File | Purpose |
|---|---|
zensical.toml |
Site configuration (name, theme, extensions, features) |
scripts/zensical_macros.py |
Macros plugin that reads markdown files and exposes them as template variables |
docs/index.md |
Homepage — renders {{ README_MAIN }} |
docs/development.md |
Dev guide — renders {{ README_DEVELOPMENT }} and {{ README_CONTRIBUTING }} |
docs/CONTRIBUTING.md |
Contributing guide — renders {{ CONTRIBUTING }} |
docs/COMMIT_TYPES.md |
Commit reference — renders {{ COMMIT_TYPES }} |
docs/support.md |
Support & issues info, with {{ SECURITY }} appended at the bottom |
docs/documentation.md |
This page (written directly, not macro-generated) |
Template Variables¶
The macros plugin (scripts/zensical_macros.py) exposes these variables for use in any docs page:
| Variable | Source |
|---|---|
{{ README_MAIN }} |
README.md without the Contributing and Development sections |
{{ README_CONTRIBUTING }} |
The ## Contributing section extracted from README.md |
{{ README_DEVELOPMENT }} |
The ## Development section extracted from README.md |
{{ CONTRIBUTING }} |
Full contents of CONTRIBUTING.md |
{{ COMMIT_TYPES }} |
Full contents of COMMIT_TYPES.md |
{{ SECURITY }} |
Full contents of SECURITY.md |
Live Reload & Watch¶
The zensical.toml config includes a watch list so that changes to the source markdown files
trigger a live reload during local development:
watch = [
"scripts/zensical_macros.py",
"README.md",
"COMMIT_TYPES.md",
"CHANGELOG.md",
"CONTRIBUTING.md",
"SECURITY.md",
]
Running Locally¶
To serve the docs site locally with live reload:
To build a static version:
Adding a New Page¶
- Create a new
.mdfile in thedocs/directory. - Add front matter with a title and icon:
- Write content directly, or use a macro variable if the content lives in a root-level file.
- If using a new macro variable, add it to
scripts/zensical_macros.pyand update thewatchlist inzensical.tomlif needed. - Update the navigation in
zensical.tomlunder thenavarray to include the new page.
Navigation Configuration¶
The site uses explicit navigation defined in zensical.toml:
nav = [
{"Getting Started" = "index.md"},
{"Support" = "support.md"},
{
"Development" = [
"development.md",
"documentation.md",
"CONTRIBUTING.md",
"COMMIT_TYPES.md"
]
},
{"GitHub Repo" = "https://github.com/jjeff07/libreclient"}
]
Pages not listed in nav won't appear in the sidebar navigation.
Link Compatibility¶
Root-level markdown files (like README.md and CONTRIBUTING.md) contain relative links such as
[COMMIT_TYPES.md](COMMIT_TYPES.md) or [CONTRIBUTING.md](CONTRIBUTING.md). For these links to
work both on GitHub and in the docs site, the docs pages must use matching filenames:
| Root file link target | Docs file |
|---|---|
CONTRIBUTING.md |
docs/CONTRIBUTING.md |
COMMIT_TYPES.md |
docs/COMMIT_TYPES.md |
This way, when the macros inject content from root files into the docs, relative links resolve correctly in both contexts without any rewriting.
Adding Content via Macros¶
If you want to reuse content from a root-level markdown file:
- Open
scripts/zensical_macros.py. - Read the file and assign it to a variable:
- Use
{{ MY_FILE }}in your docs page. - Add the source file to the
watchlist inzensical.toml.
Theme & Features¶
The site uses Zensical's default theme with light/dark mode toggle and includes features like:
- Instant navigation with prefetching
- Code block copy buttons and annotations
- Content tabs and footnote tooltips
- Navigation sections, footer navigation, and breadcrumb paths
- Search with highlighting
These are configured in the [project.theme] section of zensical.toml.