From 2e72c740efedbdc00c69b49fb767afaa3487a713 Mon Sep 17 00:00:00 2001 From: Edson Brandi Date: Wed, 13 May 2026 20:53:13 +0000 Subject: [PATCH 1/2] scripts: add zh_CN build support and language-aware dependency install Wire Chinese (Simplified) into build-book.sh as a first-class target alongside en_US, pt_BR, and es_ES, and teach setup_translation.sh how to install the system packages that translated editions need. build-book.sh: - Add zh_CN to LANGUAGES_ALL and to every language helper (get_chapters_dir, get_appendices_dir, get_pandoc_lang, get_lang_display, normalize_lang) so it flows through the existing per-language build path with no special-casing. - Wire Noto CJK fonts into the PDF build for zh_CN via the Eisvogel template's CJKmainfont/CJKsansfont/CJKmonofont variables (which auto-load xeCJK), plus a mainfont override so Latin text in the body matches the surrounding Chinese. The Latin defaults from metadata.yaml have no CJK glyphs, so this is required for the zh_CN PDF to render. - Refresh help text, error messages, output-file listing, CONTENT SOURCES, EXAMPLES, and REQUIREMENTS to include zh_CN and the CJK font / texlive-lang-chinese dependencies. setup_translation.sh: - Add install_language_dependencies(), which maps a language code to the apt packages needed to build that edition: Noto CJK fonts + texlive-lang-chinese/cjk for zh*, the Japanese and Korean equivalents for ja/ko, and the matching texlive-lang-* packs for pt/es/fr/de/it/ru. - Print the exact apt-get and fc-cache commands before running them so they can be reproduced manually, and fall back cleanly when apt-get is unavailable (non-Debian hosts) or sudo credentials are not cached. - Add a --skip-deps flag for CI and unprivileged environments that just want the directory scaffolding without touching system packages. - Update usage/help to document --skip-deps and the new zh_CN example. --- scripts/build-book.sh | 57 +++++++++++--- scripts/setup_translation.sh | 141 +++++++++++++++++++++++++++++++++-- 2 files changed, 182 insertions(+), 16 deletions(-) diff --git a/scripts/build-book.sh b/scripts/build-book.sh index 508b279..a46e23f 100755 --- a/scripts/build-book.sh +++ b/scripts/build-book.sh @@ -42,6 +42,7 @@ # en_US English (original) content/chapters, content/appendices # pt_BR Brazilian Portuguese translations/pt_BR/chapters, translations/pt_BR/appendices # es_ES Spanish translations/es_ES/chapters, translations/es_ES/appendices +# zh_CN Chinese (Simplified) translations/zh_CN/chapters, translations/zh_CN/appendices # # Running the script with no arguments builds every supported format # (PDF + EPUB + HTML) in every supported language. Individual formats or @@ -78,7 +79,7 @@ PDF_ENGINE="xelatex" # Supported languages in canonical form. The list order controls the order # used by "build everything" runs and by the final summary. -LANGUAGES_ALL=(en_US pt_BR es_ES) +LANGUAGES_ALL=(en_US pt_BR es_ES zh_CN) # ============================================================================= # LANGUAGE HELPERS @@ -90,6 +91,7 @@ get_chapters_dir() { en_US) echo "content/chapters" ;; pt_BR) echo "translations/pt_BR/chapters" ;; es_ES) echo "translations/es_ES/chapters" ;; + zh_CN) echo "translations/zh_CN/chapters" ;; *) echo ""; return 1 ;; esac } @@ -100,18 +102,21 @@ get_appendices_dir() { en_US) echo "content/appendices" ;; pt_BR) echo "translations/pt_BR/appendices" ;; es_ES) echo "translations/es_ES/appendices" ;; + zh_CN) echo "translations/zh_CN/appendices" ;; *) echo ""; return 1 ;; esac } # Map a canonical language code to its Pandoc/LaTeX `lang` metadata value. # Pandoc uses this to pick the right hyphenation/typography rules, which is -# why pt_BR and es_ES need it set explicitly instead of defaulting to en-US. +# why pt_BR, es_ES, and zh_CN need it set explicitly instead of defaulting +# to en-US. get_pandoc_lang() { case "$1" in en_US) echo "en-US" ;; pt_BR) echo "pt-BR" ;; es_ES) echo "es-ES" ;; + zh_CN) echo "zh-CN" ;; *) echo ""; return 1 ;; esac } @@ -122,6 +127,7 @@ get_lang_display() { en_US) echo "English (en_US)" ;; pt_BR) echo "Brazilian Portuguese (pt_BR)" ;; es_ES) echo "Spanish (es_ES)" ;; + zh_CN) echo "Chinese Simplified (zh_CN)" ;; *) echo "$1" ;; esac } @@ -141,6 +147,7 @@ normalize_lang() { enus) echo "en_US" ;; ptbr) echo "pt_BR" ;; eses) echo "es_ES" ;; + zhcn) echo "zh_CN" ;; *) echo "" ;; esac } @@ -272,13 +279,14 @@ FORMATS (case-insensitive; may be combined; default: all three): --html Build HTML5 --all Shorthand for --pdf --epub --html -LANGUAGES (case- and separator-insensitive; repeatable; default: all three): +LANGUAGES (case- and separator-insensitive; repeatable; default: all four): --lang CODE --lang=CODE CODE may be: en_US English (original) pt_BR Brazilian Portuguese es_ES Spanish + zh_CN Chinese (Simplified) all Every supported language (the default) Case and the separator are ignored, so the following are equivalent: pt_BR pt-BR PT_br Pt-Br ptbr PTBR @@ -289,7 +297,7 @@ OTHER OPTIONS: DEFAULTS: Running "$0" with no arguments builds every supported format (PDF, EPUB, - HTML) in every supported language (en_US, pt_BR, es_ES). + HTML) in every supported language (en_US, pt_BR, es_ES, zh_CN). OUTPUT DIRECTORY: Generated files are placed under: $OUTPUT_DIR/ @@ -307,11 +315,16 @@ OUTPUT FILES (per language): $OUTPUT_DIR/${OUTPUT_BASENAME}-es_ES.pdf $OUTPUT_DIR/${OUTPUT_BASENAME}-es_ES.epub $OUTPUT_DIR/${OUTPUT_BASENAME}-es_ES.html + Chinese Simplified (zh_CN): + $OUTPUT_DIR/${OUTPUT_BASENAME}-zh_CN.pdf + $OUTPUT_DIR/${OUTPUT_BASENAME}-zh_CN.epub + $OUTPUT_DIR/${OUTPUT_BASENAME}-zh_CN.html CONTENT SOURCES: en_US content/chapters/ content/appendices/ pt_BR translations/pt_BR/chapters/ translations/pt_BR/appendices/ es_ES translations/es_ES/chapters/ translations/es_ES/appendices/ + zh_CN translations/zh_CN/chapters/ translations/zh_CN/appendices/ EXAMPLES: $0 # Build every format in every language @@ -319,6 +332,7 @@ EXAMPLES: $0 --lang pt_BR # Build every format in Brazilian Portuguese $0 --lang pt-br --lang es-ES # Build every format in pt_BR and es_ES $0 --pdf --lang en_US # Build the English PDF only + $0 --pdf --lang zh_CN # Build the Chinese (Simplified) PDF only $0 --EPUB --HTML --Lang=Pt-Br # Mixed case (all equivalent) $0 --test # Check dependencies without building @@ -326,9 +340,12 @@ REQUIREMENTS: - Pandoc 3.0+ - XeLaTeX (texlive-xetex) - Eisvogel template at: $EISVOGEL_TEMPLATE - - LaTeX hyphenation packs for Portuguese and Spanish - (e.g. texlive-lang-portuguese, texlive-lang-spanish) - - Required fonts (Times New Roman, Arial, Liberation Mono) + - LaTeX hyphenation/language packs for the translated editions + (e.g. texlive-lang-portuguese, texlive-lang-spanish, + texlive-lang-chinese, texlive-lang-cjk) + - Required Latin fonts (Times New Roman, Arial, Liberation Mono) + - Required CJK fonts for zh_CN + (fonts-noto-cjk, fonts-noto-cjk-extra — Noto Serif/Sans/Mono CJK SC) For detailed installation instructions, see: $SCRIPT_DIR/BUILD-README.md EOF @@ -490,6 +507,25 @@ build_pdf() { return 1 fi + # Language-specific font configuration. The default fonts declared in + # scripts/metadata.yaml (Times New Roman / Arial / Liberation Mono) have + # no CJK glyphs, so zh_CN needs Noto CJK fonts wired in through the + # Eisvogel template's CJKmainfont/CJKsansfont/CJKmonofont variables + # (which auto-load xeCJK) plus a mainfont override so Latin text in the + # body shares the same visual weight as the surrounding Chinese. + local -a font_args=() + case "$lang" in + zh_CN) + font_args=( + --variable mainfont="Noto Serif CJK SC" + --variable sansfont="Noto Sans CJK SC" + --variable CJKmainfont="Noto Serif CJK SC" + --variable CJKsansfont="Noto Sans CJK SC" + --variable CJKmonofont="Noto Sans Mono CJK SC" + ) + ;; + esac + echo " Including files: ${#BUILD_FILES[@]} total (1 title + ${BUILD_FILES_CHAPTERS} chapters + ${BUILD_FILES_APPENDICES} appendices)" echo " Running pandoc with Eisvogel template (lang=$pandoc_lang)..." @@ -517,6 +553,7 @@ build_pdf() { --syntax-highlighting=tango \ --variable linestretch=1.15 \ --variable geometry:"inner=2cm,outer=2cm,top=2.5cm,bottom=2.5cm" \ + "${font_args[@]}" \ -o "$output_file" 2>&1 local exit_code=$? @@ -747,7 +784,7 @@ while [[ $# -gt 0 ]]; do canonical="$(normalize_lang "$raw_value")" if [ -z "$canonical" ]; then echo "❌ Unknown language: '$raw_value'" - echo " Accepted: en_US, pt_BR, es_ES, or all (case- and separator-insensitive)" + echo " Accepted: en_US, pt_BR, es_ES, zh_CN, or all (case- and separator-insensitive)" exit 1 fi if [ "$canonical" = "all" ]; then @@ -760,13 +797,13 @@ while [[ $# -gt 0 ]]; do --lang) shift if [ $# -eq 0 ]; then - echo "❌ --lang requires a value (en_US, pt_BR, es_ES, or all)" + echo "❌ --lang requires a value (en_US, pt_BR, es_ES, zh_CN, or all)" exit 1 fi canonical="$(normalize_lang "$1")" if [ -z "$canonical" ]; then echo "❌ Unknown language: '$1'" - echo " Accepted: en_US, pt_BR, es_ES, or all (case- and separator-insensitive)" + echo " Accepted: en_US, pt_BR, es_ES, zh_CN, or all (case- and separator-insensitive)" exit 1 fi if [ "$canonical" = "all" ]; then diff --git a/scripts/setup_translation.sh b/scripts/setup_translation.sh index 9a13332..fc6649f 100755 --- a/scripts/setup_translation.sh +++ b/scripts/setup_translation.sh @@ -121,17 +121,132 @@ show_usage() { echo " or with region (e.g., 'pt_BR', 'en_US')" echo "" echo "Options:" - echo " -h, --help Show this help message" - echo " -f, --force Force copy even if files already exist" - echo " -v, --verbose Show detailed output" + echo " -h, --help Show this help message" + echo " -f, --force Force copy even if files already exist" + echo " -v, --verbose Show detailed output" + echo " --skip-deps Do not attempt to install language-specific" + echo " system dependencies (fonts, LaTeX packs)" echo "" echo "Examples:" echo " $0 fr # Set up French translation" echo " $0 de_DE # Set up German (Germany) translation" echo " $0 es_MX # Set up Spanish (Mexico) translation" + echo " $0 zh_CN # Set up Chinese (Simplified) translation" echo "" echo "This script creates a new language directory under translations/" echo "and populates it with copies of content files for translation work." + echo "For languages that need special fonts or LaTeX hyphenation packs" + echo "(e.g. zh_CN, zh_TW, ja_JP, ko_KR), it will also try to install the" + echo "required system packages via apt-get unless --skip-deps is given." +} + +# Function to install language-specific system dependencies (fonts and +# LaTeX hyphenation packs). The default build configuration in +# scripts/metadata.yaml only covers Latin-script fonts, so CJK editions +# need additional Noto CJK fonts plus the matching texlive-lang-* packs +# in order for build-book.sh to produce a usable PDF. +# +# The function prints the exact commands first so they can be copied +# manually, then attempts to run them. It is a no-op for languages that +# do not need extra packages, and it bails out cleanly on non-Debian +# systems where apt-get is unavailable. +install_language_dependencies() { + local lang_code="$1" + local -a apt_packages=() + + case "$lang_code" in + zh|zh_CN|zh_TW|zh_HK) + # Simplified and Traditional Chinese: Noto CJK fonts plus + # texlive's Chinese/CJK language support. + apt_packages=( + fonts-noto-cjk + fonts-noto-cjk-extra + texlive-lang-chinese + texlive-lang-cjk + ) + ;; + ja|ja_JP) + apt_packages=( + fonts-noto-cjk + fonts-noto-cjk-extra + fonts-ipafont + fonts-ipafont-gothic + fonts-ipafont-mincho + texlive-lang-japanese + texlive-lang-cjk + ) + ;; + ko|ko_KR) + apt_packages=( + fonts-noto-cjk + fonts-noto-cjk-extra + fonts-nanum + texlive-lang-korean + texlive-lang-cjk + ) + ;; + pt|pt_BR|pt_PT) + apt_packages=(texlive-lang-portuguese) + ;; + es|es_ES|es_MX) + apt_packages=(texlive-lang-spanish) + ;; + fr|fr_FR) + apt_packages=(texlive-lang-french) + ;; + de|de_DE) + apt_packages=(texlive-lang-german) + ;; + it|it_IT) + apt_packages=(texlive-lang-italian) + ;; + ru|ru_RU) + apt_packages=(fonts-liberation texlive-lang-cyrillic) + ;; + *) + # No extra dependencies known for this language. + return 0 + ;; + esac + + if [ "${#apt_packages[@]}" -eq 0 ]; then + return 0 + fi + + print_header "Installing system dependencies for $lang_code" + echo "The following apt packages are required to build $lang_code:" + echo "" + echo " sudo apt-get install -y ${apt_packages[*]}" + echo "" + echo "After installation, refresh the font cache so XeLaTeX can see" + echo "any new fonts:" + echo "" + echo " sudo fc-cache -fv" + echo "" + + if ! command -v apt-get >/dev/null 2>&1; then + print_warning "apt-get not found. Skipping automatic install." + print_warning "Run the commands above manually on this system." + return 0 + fi + + if ! sudo -n true 2>/dev/null; then + print_warning "Automatic install needs sudo and the cached" + print_warning "credentials are missing. You will be prompted" + print_warning "for your password by sudo below; press Ctrl-C" + print_warning "to cancel and run the commands manually." + fi + + if sudo apt-get install -y "${apt_packages[@]}"; then + print_status "Packages installed successfully." + if command -v fc-cache >/dev/null 2>&1; then + sudo fc-cache -fv >/dev/null 2>&1 || true + print_status "Font cache refreshed." + fi + else + print_error "apt-get install failed. Run the commands above manually." + return 1 + fi } # Function to get language name from code @@ -168,7 +283,8 @@ main() { local language_code="" local force_copy=false local verbose=false - + local skip_deps=false + # Parse command line arguments while [[ $# -gt 0 ]]; do case $1 in @@ -184,6 +300,10 @@ main() { verbose=true shift ;; + --skip-deps) + skip_deps=true + shift + ;; -*) print_error "Unknown option: $1" show_usage @@ -227,12 +347,21 @@ main() { print_status "Language directory: $lang_dir" print_status "Files copied: $COPY_COUNT" print_status "Files skipped (already exist): $SKIP_COUNT" - + if [ "$SKIP_COUNT" -gt 0 ]; then print_warning "Some files already existed and were skipped." print_warning "Use --force option to overwrite existing files." fi - + + # Install language-specific system dependencies (fonts, LaTeX packs). + # Off by default for CI / unprivileged environments via --skip-deps. + if [ "$skip_deps" = true ]; then + print_status "Skipping language-specific dependency install (--skip-deps)." + else + install_language_dependencies "$language_code" || \ + print_warning "Continuing despite dependency installation issues." + fi + print_status "Translators can now start working on files in: $lang_dir" } From c288bfb19e7fa192a8c33a71281d9cce2dff9443 Mon Sep 17 00:00:00 2001 From: Edson Brandi Date: Wed, 13 May 2026 21:13:32 +0000 Subject: [PATCH 2/2] Update README.md to include informations about the language zh_CN --- scripts/README.md | 66 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 51 insertions(+), 15 deletions(-) diff --git a/scripts/README.md b/scripts/README.md index d17ee91..a44c71c 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -2,7 +2,7 @@ This document explains how to build the FreeBSD Device Drivers book using the updated build system with the Eisvogel pandoc LaTeX template. -The build system supports three languages out of the box: English (`en_US`), Brazilian Portuguese (`pt_BR`), and Spanish (`es_ES`). A single invocation of `./scripts/build-book.sh` with no arguments produces every supported format (PDF, EPUB, HTML5) in every supported language. Individual formats and languages can be selected with the `--pdf`, `--epub`, `--html`, `--all`, and `--lang` options described below. +The build system supports four languages out of the box: English (`en_US`), Brazilian Portuguese (`pt_BR`), Spanish (`es_ES`), and Simplified Chinese (`zh_CN`). A single invocation of `./scripts/build-book.sh` with no arguments produces every supported format (PDF, EPUB, HTML5) in every supported language. Individual formats and languages can be selected with the `--pdf`, `--epub`, `--html`, `--all`, and `--lang` options described below. > [!WARNING] > @@ -114,10 +114,12 @@ sudo apt install -y texlive-amsmath texlive-amssymb texlive-amsthm sudo apt install -y texlive-bibtex-extra texlive-biblatex # Install hyphenation and language packs for the translated editions. -# Required to build the Brazilian Portuguese (pt_BR) and Spanish (es_ES) -# PDFs. Already included by texlive-full, so skip this line if you chose -# the full installation above. -sudo apt install -y texlive-lang-portuguese texlive-lang-spanish +# Required to build the Brazilian Portuguese (pt_BR), Spanish (es_ES), +# and Simplified Chinese (zh_CN) PDFs. Already included by texlive-full, +# so skip these lines if you chose the full installation above. The +# Simplified Chinese edition additionally requires CJK fonts (see the +# "CJK Fonts" section below). +sudo apt install -y texlive-lang-portuguese texlive-lang-spanish texlive-lang-chinese ``` #### 4. **Font Installation** (Essential for Professional Typography) @@ -194,9 +196,10 @@ sudo apt install -y texlive-fonts-extra sudo apt install -y texlive-fonts-extra texlive-fonts-recommended ``` -**CJK Fonts (if you need Asian language support):** +**CJK Fonts (required for the Simplified Chinese edition):** ```bash -# Install Chinese, Japanese, Korean fonts +# Install Chinese, Japanese, Korean fonts (Noto CJK is required to build +# the zh_CN PDF; the build pipeline uses it as the default CJK main font) sudo apt install -y fonts-noto-cjk fonts-noto-cjk-extra # Install additional CJK fonts @@ -359,7 +362,12 @@ echo "or run 'sudo fc-cache -fv' again to ensure the font cache is updated." │ │ │ ├── part1/ │ │ │ └── ... │ │ └── appendices/ -│ └── es_ES/ # Spanish edition +│ ├── es_ES/ # Spanish edition +│ │ ├── chapters/ +│ │ │ ├── part1/ +│ │ │ └── ... +│ │ └── appendices/ +│ └── zh_CN/ # Simplified Chinese edition │ ├── chapters/ │ │ ├── part1/ │ │ └── ... @@ -379,6 +387,7 @@ Each language build reads from its own chapters and appendices tree: | `en_US` | `content/chapters/` | `content/appendices/` | | `pt_BR` | `translations/pt_BR/chapters/` | `translations/pt_BR/appendices/` | | `es_ES` | `translations/es_ES/chapters/` | `translations/es_ES/appendices/` | +| `zh_CN` | `translations/zh_CN/chapters/` | `translations/zh_CN/appendices/` | ## Building the Book @@ -391,15 +400,15 @@ To build the complete book, run the script from the root directory: ./scripts/build-book.sh ``` -**Note**: All command-line options are case-insensitive. You can use `--PDF`, `--Pdf`, `--pdf`, or any mixed case variation. Language codes (`en_US`, `pt_BR`, `es_ES`) accept either `-` or `_` as the separator and are also case-insensitive, so `pt_BR`, `pt-BR`, `PT_br`, and `ptbr` all resolve to the same canonical code. +**Note**: All command-line options are case-insensitive. You can use `--PDF`, `--Pdf`, `--pdf`, or any mixed case variation. Language codes (`en_US`, `pt_BR`, `es_ES`, `zh_CN`) accept either `-` or `_` as the separator and are also case-insensitive, so `pt_BR`, `pt-BR`, `PT_br`, and `ptbr` all resolve to the same canonical code. With no arguments the script will: 1. Check all prerequisites 2. Discover all chapters and appendices automatically for every supported language -3. Build the PDF for `en_US`, `pt_BR`, and `es_ES` using the Eisvogel template -4. Build EPUB versions for all three languages -5. Build HTML5 versions for all three languages -6. Place output files in the `public/downloads/` directory, one per language × format (nine files in total) +3. Build the PDF for `en_US`, `pt_BR`, `es_ES`, and `zh_CN` using the Eisvogel template +4. Build EPUB versions for all four languages +5. Build HTML5 versions for all four languages +6. Place output files in the `public/downloads/` directory, one per language × format (twelve files in total) If a given language has no valid chapter files, that language is skipped with a clear error message, but the build continues for the remaining languages rather than aborting. @@ -438,6 +447,7 @@ Use `--lang CODE` (or `--lang=CODE`) to restrict the build to one or more langua | `en_US` | English (original manuscript) | | `pt_BR` | Brazilian Portuguese | | `es_ES` | Spanish | +| `zh_CN` | Simplified Chinese | | `all` | Every supported language | ```bash @@ -453,6 +463,9 @@ Use `--lang CODE` (or `--lang=CODE`) to restrict the build to one or more langua # Build the Spanish EPUB and HTML5 only ./scripts/build-book.sh --epub --html --lang es_ES +# Build the Simplified Chinese PDF only +./scripts/build-book.sh --pdf --lang zh_CN + # Equivalent to running with no arguments (all formats, all languages) ./scripts/build-book.sh --all --lang all ``` @@ -469,7 +482,7 @@ The build system automatically filters out markdown files with less than 20 line ### Output Files -Every generated file is named with the canonical language code suffix so that the three editions can sit side by side in the same output directory. A full build produces nine files (three formats × three languages) under `public/downloads/`: +Every generated file is named with the canonical language code suffix so that the four editions can sit side by side in the same output directory. A full build produces twelve files (three formats × four languages) under `public/downloads/`: **English (en_US):** - **PDF**: `public/downloads/freebsd-device-drivers-en_US.pdf` @@ -486,7 +499,12 @@ Every generated file is named with the canonical language code suffix so that th - **EPUB**: `public/downloads/freebsd-device-drivers-es_ES.epub` - **HTML5**: `public/downloads/freebsd-device-drivers-es_ES.html` -Each build also sets the appropriate Pandoc/LaTeX `lang` metadata (`en-US`, `pt-BR`, or `es-ES`) so that hyphenation, quotation marks, and other locale-sensitive typography are handled correctly for the chosen language. +**Simplified Chinese (zh_CN):** +- **PDF**: `public/downloads/freebsd-device-drivers-zh_CN.pdf` +- **EPUB**: `public/downloads/freebsd-device-drivers-zh_CN.epub` +- **HTML5**: `public/downloads/freebsd-device-drivers-zh_CN.html` + +Each build also sets the appropriate Pandoc/LaTeX `lang` metadata (`en-US`, `pt-BR`, `es-ES`, or `zh-CN`) so that hyphenation, quotation marks, and other locale-sensitive typography are handled correctly for the chosen language. For `zh_CN`, the build also wires Noto CJK SC fonts into the Eisvogel template through the `CJKmainfont`, `CJKsansfont`, and `CJKmonofont` variables so that Chinese glyphs render correctly in the PDF. ## Eisvogel Template Features @@ -826,6 +844,24 @@ pandoc scripts/title.md $(find translations/es_ES/chapters translations/es_ES/ap -o public/downloads/freebsd-device-drivers-es_ES.html ``` +**Simplified Chinese (zh_CN):** + +```bash +pandoc scripts/title.md $(find translations/zh_CN/chapters translations/zh_CN/appendices -name "*.md" | sort) \ + --metadata-file=scripts/metadata.yaml \ + --to=html5 \ + --standalone \ + --embed-resources \ + --syntax-highlighting=tango \ + --toc \ + --toc-depth=2 \ + --number-sections \ + --metadata title="FreeBSD Device Drivers" \ + --metadata author="Edson Brandi" \ + --metadata lang="zh-CN" \ + -o public/downloads/freebsd-device-drivers-zh_CN.html +``` + **Note**: The `--syntax-highlighting=tango` option (new name for the deprecated `--highlight-style` flag in recent Pandoc releases) provides excellent C language syntax highlighting. Other available styles include: `pygments`, `kate`, `espresso`, `zenburn`, `monochrome`, `breezedark`, and `haddock`. You can list all available styles with `pandoc --list-highlight-styles`. ### HTML5 vs PDF Comparison