Zensical¶
This website is built with Zensical, a static site generator from the team behind Material for MkDocs. All it requires is a Markdown file for every page, and a configuration file that connects everything together. With Zensical providing the theme, search, and deployment-ready output, I can focus my time on the content of the site.
The site started out on Material for MkDocs. Zensical builds MkDocs projects with few changes, and it is where the team now develops new features, so I moved the site to it.
Useful Documentation Pages¶
- Authoring guide: the Markdown syntax and extensions
- Included icon sets
- Admonition types
- Keyboard keys syntax
- Setup: the settings in
zensical.toml - Migrate from MkDocs
Setup¶
Project Layout¶
| Path | Contents |
|---|---|
docs/ | A Markdown file for every page, and the images, JavaScript, and CSS they use |
includes/abbreviations.md | The glossary, which every page gets |
zensical.toml | The site's configuration: the page tree, theme, plugins, and Markdown extensions |
The README explains how to install Zensical and run it, and the repository's other tools.
Page Tree Example¶
Based on this site. Paths in the page tree are relative to docs/.
nav = [
{ "Home" = "index.md" }, # Homepage, first tab
{ "Setup" = [ # Second tab
"setup/index.md", # Second tab homepage
{ "Settings" = "setup/settings.md" }, # Second tab first page
] },
{ "Reference" = [ # Third tab
{ "Zensical" = "reference/zensical.md" }, # Third tab first page (no third tab homepage)
] },
]
Plugins¶
Zensical has its own implementations of popular MkDocs plugins, so they need no installation:
- social: a card for each page, shown when a link to it is shared
- glightbox: opens images in a lightbox
- redirects: sends
/reference/mkdocs/, this page's URL before Zensical, here - minify: makes the HTML smaller
- Search, which is always on
Drafts¶
A page named *.draft.md appears when previewing the site with make serve, but not in the published site. See draft_docs.
Reference¶
Demonstrations of the features I use. This page's source shows their Markdown syntax. View the authoring guide for what to add to the configuration file to enable a feature.
Collapsible blocks, code block formatting, embedding external files¶
Click to toggle open/close
Syntax highlighting for inline code: Python's range() function...
| Embed of zensical.toml | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |
Content tabs, icons, glossary¶
Markdown:
Use the term (i.e. "WSL"). The glossary is appended to every page, so there is nothing to import.
Result:
WSL is a term in the glossary.
Table, keyboard keys¶
| Shortcut | Description |
|---|---|
| Alt + (Shift) + Tab | Navigate between windows |
| Win+Ctrl + Left/Right | Navigate between virtual desktops |
| F11 | Fullscreen |
Task list, inline math equations¶
- Result of task list
- Prove \(e=mc^2\)
KaTeX typesets the math.
Diagrams, text formatting¶
graph LR
A[Pull request] --> B[Lint]
A --> C[Build]
B --> D[Merge to main]
C --> D
D --> E[Deploy to GitHub Pages] Highlighted, inserted, and deleted text; H2O and 210. See diagrams and formatting.
Building and Deploying¶
Every push and pull request builds the site in strict mode, which fails on a broken link or anchor, or a missing snippet. The Deploy workflow builds the site again on every push to the main branch, and on demand, then deploys it to GitHub Pages. Only its deploy job can publish the site.
Deploy workflow for this project
Example Sites¶
- Zensical and PyMdown Extensions documentation
- This site!