视觉画布设计
canvas-design
基于设计原则创作静态视觉作品,用于海报与品牌图形。
mkdocs【文档与办公】MkDocs is a Python static site generator that builds a documentation site from Markdown files and one mkdocs.yml, most often with the Material for MkDocs theme. Use when a user asks to create project documentation, configure MkDocs themes, add search and navigation, customize Markdown extensions, deploy docs to GitHub Pages, version docs with mike, o…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
MkDocs turns a folder of Markdown files and one mkdocs.yml into a static documentation site. Most sites pair it with Material for MkDocs (mkdocs-material), which adds the theme, search, navigation features, tags, blog and social cards. The ecosystem changed in 2025–2026, so check the state before starting (as of October 2026):
pip install mkdocs installs it. There has been no 1.x release since.2.0.dev6, installed only with pip install --pre). It is a rewrite: according to the Material for MkDocs maintainers it drops the plugin system, replaces the theming API and does not read mkdocs.yml (2.0.dev6 stops with an error when it finds one), so no existing Material site builds on it.mkdocs>=1.6,<2.zensical, MIT) is the successor from the same team. It reads an existing mkdocs.yml, reimplements the popular plugins natively and is released about once a week. It is at 0.0.67, a series its own team calls alpha; they have announced 0.1.0, the first release line they describe as dependable, for November 5, 2026.properdocs) is a community fork of MkDocs 1.x that aims to be a drop-in replacement.mkdocs.yml with Zensical alongside and switch when every plugin you depend on is supported (Example 2).--pre or leave mkdocs unpinned in a Material project.python3 -m venv .venv && source .venv/bin/activate
pip install "mkdocs-material==9.7.7" # installs mkdocs 1.6.1
mkdocs new ledger-docs && cd ledger-docs # creates mkdocs.yml and docs/index.md
mkdocs serve # live preview at http://127.0.0.1:8000
mkdocs build --strict # static site in site/; warnings fail the build
pip freeze > requirements.txt # lock the versions for CI
Material prints a red notice about MkDocs 2.0 on every build; export NO_MKDOCS_2_WARNING=1 silences it.
# mkdocs.yml
site_name: Ledger SDK Documentation
site_url: https://docs.ledgerkit.dev/
repo_url: https://github.com/ledgerkit/ledger-sdk
repo_name: ledgerkit/ledger-sdk
theme:
name: material
palette:
- scheme: default
primary: indigo
accent: indigo
toggle:
icon: material/brightness-7
name: Switch to dark mode
- scheme: slate
primary: indigo
accent: indigo
toggle:
icon: material/brightness-4
name: Switch to light mode
features:
- navigation.instant # SPA-like navigation (needs site_url)
- navigation.tracking # URL follows the active heading
- navigation.tabs # top-level sections as tabs
- navigation.sections
- navigation.expand
- navigation.top # back-to-top button
- search.suggest
- search.highlight
- content.code.copy # copy button on code blocks
- content.code.annotate # code annotations
- content.tabs.link # linked content tabs
- announce.dismiss
plugins:
- search # must be listed again once `plugins` is set
- tags
- social # needs: pip install "mkdocs-material[imaging]"
markdown_extensions:
- admonition # callout boxes
- pymdownx.details # collapsible callouts
- pymdownx.superfences # nested code blocks, Mermaid
- pymdownx.tabbed:
alternate_style: true # content tabs
- pymdownx.highlight:
anchor_linenums: true
- pymdownx.emoji:
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg
- attr_list
- md_in_html
- toc:
permalink: true
nav:
- Home: index.md
- Getting Started:
- Installation: guide/installation.md
- Quick Start: guide/quickstart.md
- API Reference:
- Client: api/client.md
- Changelog: changelog.md
!!! note "Sandbox keys"
Keys that start with `lk_test_` only reach the sandbox.
!!! warning
This endpoint is rate limited to 60 requests per minute.
??? info "Click to expand"
A collapsible admonition (`pymdownx.details`).
=== "Python"
```python
client = Client(
api_key=os.environ["LEDGER_API_KEY"], # (1)!
timeout=30, # (2)!
)
```
1. Create the key under Settings → API keys.
2. Seconds. The default is 60.
=== "cURL"
```bash
curl -H "Authorization: Bearer $LEDGER_API_KEY" https://api.ledgerkit.dev/v1/invoices
```
The (1)! markers are code annotations (content.code.annotate); the numbered list directly below the block supplies their text.
pip install "mkdocstrings[python]" # then add `- mkdocstrings` under plugins
pip install mike # versioned docs on the gh-pages branch
mike deploy --push --update-aliases 2.1 latest
mike set-default --push latest
mkdocs gh-deploy --force # unversioned: build and push site/ to gh-pages
::: ledger_sdk.Client renders that class from its docstrings.extra: { version: { provider: mike } } to mkdocs.yml. Use either mike or mkdocs gh-deploy on a repository, not both.pip install -r requirements.txt with permissions: contents: write, and set the Pages source to the gh-pages branch.pip install "zensical==0.0.67"
zensical new handbook # zensical.toml, docs/, .github/workflows/docs.yml
cd handbook
zensical serve # preview at localhost:8000
zensical build --clean # static site in site/
zensical build and zensical serve also run in a directory that only has mkdocs.yml. Not supported there: hooks, exclude_docs, draft_docs, not_in_nav, the gh-deploy and get-deps commands, and the --site-dir, --theme and --use-directory-urls flags (set them in the config). Plugins without a native replacement are skipped silently. theme: { variant: classic } keeps the Material look; the default is the new modern design.
Example 1: Documentation for a Python SDK, published on GitHub Pages
User: "Set up docs for our SDK with MkDocs Material and publish them from CI."
python3 -m venv .venv && source .venv/bin/activate
pip install "mkdocs-material[imaging]==9.7.7" "mkdocstrings[python]"
mkdocs new . && pip freeze > requirements.txt
Write the mkdocs.yml shown above with - mkdocstrings added to plugins, put ::: ledger_sdk.Client in docs/api/client.md, create the other pages listed under nav: (a missing one aborts a --strict build), then add the workflow:
# .github/workflows/docs.yml
name: docs
on:
push:
branches: [main]
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: pip install -r requirements.txt
- run: mkdocs gh-deploy --force --strict
Result: mkdocs build --strict ends with INFO - Documentation built in 7.85 seconds; site/ contains index.html, api/client/index.html with the methods of Client, search/, sitemap.xml and one social card PNG per page under site/assets/images/social/. Each push to main updates the gh-pages branch.
Example 2: Try Zensical on an existing Material for MkDocs site
User: "Material for MkDocs is in maintenance mode. Can our docs move to Zensical?"
python3 -m venv .venv-zensical
.venv-zensical/bin/pip install "zensical==0.0.67" mkdocstrings-python
.venv-zensical/bin/zensical build --clean
Build started
No issues found
Build finished in 4.21s
Compare site/ with the MkDocs output page by page (navigation, search, tabs, annotations, API pages), and check every entry under plugins: against the supported list at https://zensical.org/docs/compatibility/mkdocs/plugins/. The same mkdocs.yml keeps building with mkdocs build, so the production pipeline stays untouched until the comparison is clean; then replace mkdocs gh-deploy in CI with zensical build --clean plus a GitHub Pages upload (the workflow zensical new generates shows the steps).
mkdocs-material==9.7.7 (or an exact zensical version) in requirements.txt; rebuild the lock file on purpose, not on every CI run--strict in CI — broken links and missing nav entries fail the build instead of shippingmkdocs-material rather than the built-in mkdocs and readthedocs themes for search, tabs, annotations and dark mode(1)! for inline explanations instead of long commentscontent.tabs.link keeps the choice across the page!!! note/warning/tip/danger; more visible than bold textsocial plugin needs the imaging extra plus the Cairo system library; a stale .cache/ can hide the missing dependency, so add .cache/ to .gitignore and install the extra in CImike keeps each version in its own folder on gh-pages; with Zensical it works through the fork squidfunk/mike until native versioning shipshooks: run arbitrary Python during the build; install only plugins you trust