Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Tooike/modern-cpp-tutorial
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: changkun/modern-cpp-tutorial
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 20 commits
  • 38 files changed
  • 1 contributor

Commits on Jun 7, 2026

  1. Configuration menu
    Copy the full SHA
    6629382 View commit details
    Browse the repository at this point in the history
  2. website: show one language at a time on the homepage

    Replace the stacked Chinese+English heroes on the root page with a
    single hero plus a 中文/English toggle. The language is auto-detected
    from the browser on first visit and remembered in localStorage; the
    non-active language is hidden by default to avoid a flash of both.
    changkun committed Jun 7, 2026
    Configuration menu
    Copy the full SHA
    66b1a38 View commit details
    Browse the repository at this point in the history
  3. code: sync structured-binding example with rewritten book

    The why-first rewrite of Chapter 2 added a second structured-binding
    example — binding key/value pairs while iterating a std::map. Extend the
    companion file so the downloadable code matches what the book now shows.
    This was the only code block that changed across the whole book since the
    companion code was last synced (f148826).
    changkun committed Jun 7, 2026
    Configuration menu
    Copy the full SHA
    add210d View commit details
    Browse the repository at this point in the history
  4. website: rebrand version strings to C++11 to C++26

    The book was rebranded from C++11/14/17/20 to 'C++11 to C++26', but the
    site title, header, hero, and meta description still showed the old
    range. Bring them in line with the book and the site _config.
    changkun committed Jun 7, 2026
    Configuration menu
    Copy the full SHA
    78d2505 View commit details
    Browse the repository at this point in the history
  5. website: hygiene pass on the theme

    Remove dead and obsolete front-end cruft:
    - Drop pivot.js loaded from cdn.rawgit.com (shut down in 2019; the hero
      shine effect silently 404'd on the live site).
    - Remove FastClick (the 300ms tap delay it patched is gone from modern
      mobile browsers).
    - Remove the Universal Analytics gtag snippet (UA properties stopped
      collecting data in July 2023).
    - Delete vestigial #highlights and .social-buttons CSS that no layout
      references, and the fixed-footer spacing hacks (margin-bottom: 200px).
    - Make the homepage footer normal-flow instead of position: fixed so it
      no longer overlaps content.
    - Fix the logo font stack to list only fonts actually loaded (Dosis was
      referenced but never linked, so it silently fell back).
    - Upgrade protocol-relative font CDN link to https.
    changkun committed Jun 7, 2026
    Configuration menu
    Copy the full SHA
    f6faf02 View commit details
    Browse the repository at this point in the history
  6. website: upgrade Hexo toolchain to patch npm vulnerabilities

    Bump hexo 5.4.0 -> 8.1.2 and all renderer/generator plugins (and serve)
    to their latest majors, then regenerate package-lock.json. Local
    'npm audit' now reports 0 vulnerabilities, down from the 46 open
    Dependabot alerts (all in this build-time dependency tree -- none of it
    ships to readers). The GitHub Dependabot alerts should auto-close once
    this lands on master and is rescanned.
    
    Two fixes were needed to keep the site building under the new toolchain:
    - Quote the title in book/en-us/09-others.md. Hexo 8's stricter js-yaml
      rejects the unquoted 'Chapter 09: Minor Features' (the second colon
      parses as a nested mapping); every other chapter title was already
      quoted.
    - Set marked.prependRoot: false. hexo-renderer-marked 6+ prepends the
      site root to relative image paths by default, turning the book's
      ../../assets/figures/*.png into a broken /../../assets/... path. This
      restores the original relative paths.
    
    Verified locally (Node 25): full build succeeds with no errors, all 32
    chapter pages plus homepage/about render, syntax highlighting and image
    captions intact, no broken image paths in the output. NOT yet verified
    in CI -- see the build-env image note in the following commit.
    changkun committed Jun 7, 2026
    Configuration menu
    Copy the full SHA
    74755a1 View commit details
    Browse the repository at this point in the history
  7. docker: pin build-env base to node:22-bookworm

    The CI deploy runs inside the prebuilt changkun/modern-cpp-tutorial:build-env
    image. Per the Docker Hub API that image was last pushed 2019-07-15 and
    never updated -- built from node:latest, which was Node 12 at the time.
    Hexo 8 requires Node >= 20.19, so that stale image cannot run the
    upgraded toolchain; pushing the Hexo 8 upgrade without rebuilding it will
    break the deploy at 'hexo generate'.
    
    Pin to a concrete current LTS so the rebuild is deterministic and won't
    silently drift again. NOTE: this Dockerfile change is untested -- the
    image still dpkg-installs a 2019 pandoc 2.7.3 .deb and texlive-full, and
    CI's make target builds pdf+epub as well as the site, so a rebuild needs
    a one-off test ('make build-env' then a full 'make') before relying on
    it to deploy.
    changkun committed Jun 7, 2026
    Configuration menu
    Copy the full SHA
    a88a18a View commit details
    Browse the repository at this point in the history

Commits on Jun 21, 2026

  1. website: make landing single-language with a link switcher

    The landing page rendered both Chinese and English heroes into one HTML
    document and toggled between them with client-side JS. Mirror the
    single-language model the book pages and the reference sites already use:
    index.ejs now renders one hero/footer chosen by page.type, the switcher is
    a plain link, and a dedicated English landing lives at /modern-cpp/en/.
    
    Also fix stale shell copy: <html lang> was hardcoded to en on every page
    (now follows page.type), the README purpose lines said C++ 'before 2020s'
    (now C++11 through C++26), and _config.yml description was the author name.
    changkun committed Jun 21, 2026
    Configuration menu
    Copy the full SHA
    726fd10 View commit details
    Browse the repository at this point in the history
  2. website: localize page title and de-underline the landing switcher

    The <title> was a fixed Chinese-led bilingual string on every page; branch
    it on page.type so the English landing announces itself in English. Add
    text-decoration:none to the anchor switcher so it renders as the button it
    replaced rather than an underlined link.
    changkun committed Jun 21, 2026
    Configuration menu
    Copy the full SHA
    e5b9509 View commit details
    Browse the repository at this point in the history
  3. website: patch dompurify and form-data via npm audit fix

    Clears the 3 open Dependabot alerts, all transitive through
    hexo-renderer-marked: dompurify 3.4.8 -> 3.4.11 (Trusted Types policy and
    ALLOWED_ATTR pollution advisories) and form-data 4.0.5 -> 4.0.6 (CRLF
    injection via multipart field names). Lockfile-only; build and markdown
    rendering verified unchanged.
    changkun committed Jun 21, 2026
    Configuration menu
    Copy the full SHA
    490a6ac View commit details
    Browse the repository at this point in the history
  4. ci: rebuild website workflow without the texlive Docker image

    The pipeline shelled out to a hand-maintained 3.4 GB texlive build-env
    image on Docker Hub (last rebuilt 2019, Node ~2019). The Jun-7 Hexo 8 /
    chokidar 4 upgrade needs Node >= 20.19, so that stale container failed at
    'Cannot find module fs/promises'.
    
    Replace it with a native, Docker-free workflow: checkout@v4 + setup-node@v4
    (Node 22, npm cache), npm ci, build the Hexo site, and deploy over SSH with
    the existing SERVER_* secrets. The website needs only Node and Python 3, so
    no texlive is required. PDF/epub are no longer rebuilt in CI; the copies on
    the server are left untouched (scp overwrites, never deletes) so their
    download links keep working.
    changkun committed Jun 21, 2026
    Configuration menu
    Copy the full SHA
    dab1a01 View commit details
    Browse the repository at this point in the history
  5. website: auto-route root by browser language; harden landing flag

    Make the site behave like a real bilingual site at the entry point. A
    non-Chinese browser (or anyone whose remembered choice is English) hitting
    the root now lands on the English page instead of a wall of Chinese; an
    explicit 'zh' choice is honored and never bounced. The redirect runs as the
    first thing in <head>, before the non-async vue script, so it is not blocked
    on a download. Landing switchers write the choice to localStorage so the
    auto-route respects it.
    
    Also inline the landing flag's size so it can never depend on a cached
    stylesheet rule (the cause of the giant-flag render after the button->anchor
    change shipped while old CSS was still cached).
    changkun committed Jun 21, 2026
    Configuration menu
    Copy the full SHA
    845f01f View commit details
    Browse the repository at this point in the history
  6. website: make the About section properly bilingual

    The About pages (Donate/Copyright/Acknowledgements) always rendered with
    Chinese chrome regardless of the reader's language, and Acknowledgements
    stacked English on top of Chinese. An English reader reached them from the
    English menu and got a Chinese page.
    
    Introduce an 'about-en' page type (the theme's 'type' field selects both
    menu language and which section's table-of-contents to list, so a separate
    type is the clean way to split). Route the shared partials -- header, page,
    sidebar, layout -- through a single isEn = book-en-us || about-en helper.
    Add English About pages under /about/en/, point the English menu and the
    English book footer at them, and reduce each Chinese About page to Chinese
    only. donate.md becomes a committed source file (was generated from
    assets/, which stays bilingual for the GitHub README), so it drops out of
    the Makefile copy/clean and .gitignore.
    changkun committed Jun 21, 2026
    Configuration menu
    Copy the full SHA
    79f8a66 View commit details
    Browse the repository at this point in the history
  7. website: language switch goes to the same page, not the preface

    The header language menu always linked to the other language's preface, so
    switching language from chapter 7 or an About page dumped you at the
    preface. Map to the equivalent page instead: swap the zh-cn<->en-us segment
    for book chapters, /about/<->/about/en/ for About pages, and fall back to
    the other language's landing for anything else. Drop target=_blank so the
    switch happens in place, and record the choice in localStorage so the root
    auto-route honors it.
    changkun committed Jun 21, 2026
    Configuration menu
    Copy the full SHA
    f0c133d View commit details
    Browse the repository at this point in the history
  8. website: fix English book sidebar heading (was 'Book-en-us')

    The sidebar section heading matched only book-zh-cn, so English chapters
    fell through to the raw-type fallback and showed 'Book-en-us'. Match
    book-en-us too so it reads 'Main', mirroring the Chinese '正文'.
    changkun committed Jun 21, 2026
    Configuration menu
    Copy the full SHA
    4151837 View commit details
    Browse the repository at this point in the history
  9. website: drop the duplicate landing language switch

    The landing showed two language switches: the hero #lang-switch button and
    the header nav language dropdown (used on every other page). Remove the
    redundant hero button and its now-dead CSS; the nav dropdown is the single
    switcher, and it already records the choice in localStorage for the root
    auto-route.
    changkun committed Jun 21, 2026
    Configuration menu
    Copy the full SHA
    ee052b3 View commit details
    Browse the repository at this point in the history
  10. website: real SEO/i18n head — hreflang, OG/Twitter, canonical, favicon

    The <head> was minimal and not multilingual-aware. Add, per page and per
    language: a self-referential canonical; rel=alternate hreflang zh-CN/en/
    x-default linking each page to its translation (computed with the same
    zh-cn<->en-us / about<->about/en logic the visible switcher uses); Open
    Graph + Twitter Card tags with og:locale/og:locale:alternate; a per-language
    meta description (was one mixed-language string site-wide). Replace the
    1.6 MB cover-PNG favicon with a real 32x32 favicon + 180x180 apple-touch-icon
    (the book mascot). Drop maximum-scale/user-scalable from viewport (a WCAG
    1.4.4 pinch-zoom failure).
    changkun committed Jun 21, 2026
    Configuration menu
    Copy the full SHA
    39c975e View commit details
    Browse the repository at this point in the history
  11. website: shell cleanup — dead config, alt text, stray tags, vestigial…

    … assets
    
    Remove three dead theme _config keys (google_analytics, root_domain,
    moderncpp_version — none referenced anywhere). Strip the unmatched trailing
    </a> from both book footers. Add alt text to the hero cover and header logo
    images. Remove the commented-out Code/Exercises/Answers nav block (Answers
    was never built). Delete vestigial assets: lang/de.svg (no German edition)
    and the unused check/down/feed/search PNGs.
    changkun committed Jun 21, 2026
    Configuration menu
    Copy the full SHA
    dd5e8bd View commit details
    Browse the repository at this point in the history
  12. website: stop emitting the stray /2026 dated post

    src/_posts/index.md exists only to drive hexo-generator-index (the
    homepage), but Hexo also rendered it as a dated post at /2026/06/21/index/
    — unlinked, empty, indexable junk. Pin that post to a fixed permalink and
    strip it after generate in the Makefile, keeping the homepage intact.
    changkun committed Jun 21, 2026
    Configuration menu
    Copy the full SHA
    bf50489 View commit details
    Browse the repository at this point in the history
  13. website,book: fix link rewriting that mangled external URLs

    filter.py rewrote cross-chapter links with the loose regex (./)(.*?)(.md),
    whose unescaped dots matched any ':/ … md' span — so a chapter line with an
    external URL like '#cmdoption-…' got corrupted into 'https..//…' on the
    built site. Anchor the rewrite to the ](./NN-name.md) link syntax with a
    simple filename so external URLs are never touched; chapter cross-links and
    #anchors still resolve.
    
    Also repoint the preface Code/Exercises links at the GitHub tree (they were
    relative dir links that 404 on the static site — no directory index — and
    the English one had an 'exercise' typo); GitHub URLs work on the site, on
    GitHub, and in the PDF.
    changkun committed Jun 21, 2026
    Configuration menu
    Copy the full SHA
    24f9dd5 View commit details
    Browse the repository at this point in the history
Loading