Migrate from mkdocs to properdocs

- Replace mkdocs-with-pdf + weasyprint with properdocs>=1.6.7
- Add pymdown-extensions for richer markdown support
- Remove heavy apt dependencies (weasyprint, fonts-noto-cjk, wget, unzip)
- Switch build command from 'mkdocs build' to 'properdocs build --strict'
- Update template: add offline plugin, fix palette, add content.code.select/copy
- Add md_in_html, pymdownx.tilde, emoji, mermaid, annotation icon support
- Fix broken icon path material//weather-sunny

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Anduin Xue
2026-05-04 13:20:03 +00:00
parent 1857c9e313
commit a7d81fa681
3 changed files with 29 additions and 13 deletions

View File

@@ -13,6 +13,8 @@ theme:
language: zh language: zh
features: features:
- content.code.annotate - content.code.annotate
- content.code.select
- content.code.copy
# - content.tabs.link # - content.tabs.link
# - header.autohide # - header.autohide
# - navigation.expand # - navigation.expand
@@ -31,18 +33,28 @@ theme:
# - toc.integrate # - toc.integrate
search_index_only: true search_index_only: true
palette: palette:
- media: "(prefers-color-scheme)"
toggle:
icon: material/link
name: Switch to light mode
- media: "(prefers-color-scheme: light)" - media: "(prefers-color-scheme: light)"
scheme: default scheme: default
primary: indigo
accent: indigo
toggle: toggle:
icon: material//weather-sunny icon: material/toggle-switch
name: Switch to dark mode name: Switch to dark mode
- media: "(prefers-color-scheme: dark)" - media: "(prefers-color-scheme: dark)"
scheme: slate scheme: slate
primary: black
accent: indigo
toggle: toggle:
icon: material/weather-night icon: material/toggle-switch-off
name: Switch to light mode name: Switch to system preference
extra:
icon: icon:
annotation: material/arrow-right-circle
admonition: admonition:
note: octicons/tag-16 note: octicons/tag-16
abstract: octicons/checklist-16 abstract: octicons/checklist-16
@@ -58,25 +70,30 @@ theme:
quote: octicons/quote-16 quote: octicons/quote-16
markdown_extensions: markdown_extensions:
- md_in_html
- admonition - admonition
- pymdownx.details - pymdownx.details
- pymdownx.superfences - pymdownx.superfences
- abbr - abbr
- pymdownx.snippets - pymdownx.snippets
- pymdownx.tilde
- def_list - def_list
- pymdownx.tasklist: - pymdownx.tasklist:
custom_checkbox: true custom_checkbox: true
- attr_list - attr_list
- pymdownx.emoji:
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg
- pymdownx.superfences:
custom_fences:
- name: mermaid
class: mermaid
format: !!python/name:pymdownx.superfences.fence_code_format
plugins: plugins:
- offline
- same-dir - same-dir
- search - search
- with-pdf:
author: GitHub Community
copyright: The Unlicense
cover_title: How To Cook
cover_subtitle: 程序员做饭指南
output_path: document.pdf
- minify: - minify:
minify_html: true minify_html: true

View File

@@ -12,9 +12,8 @@ RUN npm run lint
FROM python:3.11 AS python-env FROM python:3.11 AS python-env
WORKDIR /app WORKDIR /app
COPY --from=lint-env /app . COPY --from=lint-env /app .
RUN apt-get update && apt-get install -y weasyprint fonts-noto-cjk wget unzip
RUN rm node_modules -rf && pip install -r requirements.txt RUN rm node_modules -rf && pip install -r requirements.txt
RUN mkdocs build RUN python3 -m properdocs build --strict
# ============================ # ============================
# Prepare Runtime Environment # Prepare Runtime Environment

View File

@@ -1,5 +1,5 @@
mkdocs-material mkdocs-material
mkdocs-same-dir mkdocs-same-dir
mkdocs-minify-plugin mkdocs-minify-plugin
mkdocs-with-pdf properdocs>=1.6.7
weasyprint pymdown-extensions