From 123d698e43fd1982ef86a8b01284bcfcc0ea8fb4 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Thu, 22 Oct 2026 18:47:22 +0200 Subject: [PATCH] feat: build the site with Astro Starlight generate_site.py writes the Starlight project in website/ and nothing else: mkdocs.yml, the MkDocs hooks, theme overrides and stylesheet go, and the wiki is written in Starlight's syntax. Both workflows set up Node with the official actions/setup-node pinned by commit, run npm ci from the committed lockfile, build with the strict link validator and check the result with validate_site.py. The search weighs a page by what it answers: Start here pages first, a system page's cards and file names before a guide citing them, deep guides, launchers, aliases and frozen copies after. Status badges, hash blocks and the export change lists leave the index. The ranking sits at the centre of a range where the 13 queries of search_gate.py all answer, in the search box itself. 839 pages, every URL and 45,611 ids match the MkDocs build. The tests read the Starlight content and syntax. --- .github/workflows/deploy-site.yml | 29 +- .github/workflows/validate.yml | 24 +- .gitignore | 3 +- CONTRIBUTING.md | 3 +- .../assets => }/brand/apple-touch-icon.png | Bin .../assets => }/brand/favicon-32.png | Bin .../{overrides/assets => }/brand/favicon.svg | 0 .../{overrides/assets => }/brand/logo.svg | 0 docs_assets/extra.css | 977 ------------------ docs_assets/overrides/404.html | 37 - docs_assets/overrides/main.html | 58 -- docs_assets/site.js | 298 ------ mkdocs.yml | 878 ---------------- pyproject.toml | 13 +- scripts/artifacts.py | 2 +- scripts/generate_readme.py | 9 +- scripts/generate_site.py | 388 +++---- scripts/make_site_icons.py | 6 +- scripts/mkdocs_hooks.py | 37 - scripts/pipeline.py | 14 +- scripts/siteexports.py | 19 +- scripts/sitemarkup.py | 17 +- scripts/sitestarlight.py | 103 +- scripts/validate_schemas.py | 4 +- scripts/validate_site.py | 54 +- tests/sitepages.py | 46 + tests/test_audit_regressions.py | 54 +- tests/test_contributing_text.py | 19 +- tests/test_export_report.py | 20 +- tests/test_prose_style.py | 22 +- tests/test_schema_semantic_gate.py | 4 +- tests/test_site_content_data.py | 2 +- tests/test_site_copy.py | 95 +- tests/test_site_cores.py | 3 +- tests/test_site_emulator_page.py | 13 +- tests/test_site_exports.py | 31 +- tests/test_site_funnel.py | 70 +- tests/test_site_images.py | 10 +- tests/test_site_render.py | 42 +- tests/test_site_system_links.py | 2 +- tests/test_site_validation.py | 66 +- tests/test_site_weight.py | 45 +- tests/test_workflow_paths.py | 35 +- website/astro.config.mjs | 19 +- website/src/components/MarkdownContent.astro | 11 +- website/src/content.config.ts | 4 +- website/src/styles/retrobios.css | 3 +- website/tools/search_gate.py | 53 +- website/tools/search_scores.mjs | 10 +- wiki/adding-a-platform.md | 2 +- wiki/architecture.md | 8 +- wiki/community-tools.md | 5 +- wiki/faq.md | 7 +- wiki/first-install.md | 61 +- wiki/getting-started.md | 2 +- wiki/glossary.md | 9 +- wiki/legal.md | 7 +- wiki/reference-terms.md | 7 +- wiki/release-process.md | 49 +- wiki/technical-faq.md | 7 +- wiki/testing-guide.md | 22 +- wiki/tools.md | 6 +- wiki/troubleshooting.md | 7 +- wiki/what-are-bios-files.md | 9 +- 64 files changed, 742 insertions(+), 3118 deletions(-) rename docs_assets/{overrides/assets => }/brand/apple-touch-icon.png (100%) rename docs_assets/{overrides/assets => }/brand/favicon-32.png (100%) rename docs_assets/{overrides/assets => }/brand/favicon.svg (100%) rename docs_assets/{overrides/assets => }/brand/logo.svg (100%) delete mode 100644 docs_assets/extra.css delete mode 100644 docs_assets/overrides/404.html delete mode 100644 docs_assets/overrides/main.html delete mode 100644 docs_assets/site.js delete mode 100644 mkdocs.yml delete mode 100644 scripts/mkdocs_hooks.py create mode 100644 tests/sitepages.py diff --git a/.github/workflows/deploy-site.yml b/.github/workflows/deploy-site.yml index 27ca1287..5d4b370d 100644 --- a/.github/workflows/deploy-site.yml +++ b/.github/workflows/deploy-site.yml @@ -29,7 +29,6 @@ on: - "scripts/largefiles.py" - "scripts/launchers.py" - "scripts/manifestselect.py" - - "scripts/mkdocs_hooks.py" - "scripts/nativemode.py" - "scripts/packextras.py" - "scripts/packpaths.py" @@ -69,7 +68,9 @@ on: - "database.json" - "release.json" - "derivable.json" - - "mkdocs.yml" + # The Starlight project: config, components, styles, lockfile. Its + # generated folders are gitignored and never trigger anything. + - "website/**" - ".github/workflows/deploy-site.yml" workflow_dispatch: @@ -95,11 +96,18 @@ jobs: with: python-version: "3.12" - # mkdocs-material >= 9.7.5 caps mkdocs < 2, and the upper bound keeps a major - # theme release from changing the site without a deliberate bump here. - # mkdocs is pinned below 2 on its own too: MkDocs 2 drops plugins, and the - # theme, in maintenance mode since 9.7.0, will not follow it. - - run: pip install pyyaml "jsonschema[format-nongpl]==4.26.0" "mkdocs>=1.6,<2" "mkdocs-material>=9.7.5,<10" "pymdown-extensions>=10.14" + - run: pip install pyyaml "jsonschema[format-nongpl]==4.26.0" + + # Node builds the site only: the scripts stay Python. The engine and + # its plugins are pinned exactly in website/package.json and resolved + # from the committed lockfile. + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: "24" + cache: npm + cache-dependency-path: website/package-lock.json + + - run: npm ci --prefix website - name: Validate data contracts run: python scripts/validate_schemas.py @@ -122,8 +130,9 @@ jobs: run: | python scripts/generate_site.py python scripts/generate_readme.py --db database.json --platforms-dir platforms - mkdocs build --strict - python scripts/validate_site.py + # starlight-links-validator fails the build on a dead link or anchor. + npm run build --prefix website + python scripts/validate_site.py --site-dir website/dist # write_if_changed() compares content with its timestamp line stripped, # so a run that only moves the clock leaves the file untouched and this @@ -137,7 +146,7 @@ jobs: - name: Upload artifact uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5 with: - path: site/ + path: website/dist/ deploy: needs: build diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 915696b7..7f0ccb19 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -29,7 +29,7 @@ on: - "database.json" - "release.json" - "derivable.json" - - "mkdocs.yml" + - "website/**" # Spelled out twice because the workflow parser reads no YAML anchor. A test # holds the two lists equal. push: @@ -53,7 +53,7 @@ on: - "database.json" - "release.json" - "derivable.json" - - "mkdocs.yml" + - "website/**" permissions: contents: read @@ -213,10 +213,18 @@ jobs: run: python3.9 -m pip install pyyaml "jsonschema[format-nongpl]==4.25.1" # markdown: the site validation test renders a wiki line to prove the - # heading guard's premise, and skipped on every run without it. The docs - # group builds the site as deploy-site.yml does, with the same bounds. + # heading guard's premise, and skipped on every run without it. - name: Install dependencies - run: pip install pyyaml "jsonschema[format-nongpl]==4.26.0" "markdown==3.10.2" "mkdocs>=1.6,<2" "mkdocs-material>=9.7.5,<10" "pymdown-extensions>=10.14" + run: pip install pyyaml "jsonschema[format-nongpl]==4.26.0" "markdown==3.10.2" + + # The site is built as deploy-site.yml builds it, from the lockfile. + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: "24" + cache: npm + cache-dependency-path: website/package-lock.json + + - run: npm ci --prefix website # The exporter fidelity cases compare what we hand back against the # file each platform publishes, so they need those files. They skip @@ -234,7 +242,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # docs/ is gitignored, and the tests that read the rendered pages fail + # The pages are gitignored, and the tests that read them fail # in CI without it. The suite runs whatever this step returned, so a # generator that stops still leaves every other test reporting. - name: Generate the site @@ -256,8 +264,8 @@ jobs: - name: Build the site if: ${{ !cancelled() }} run: | - mkdocs build --strict - python scripts/validate_site.py + npm run build --prefix website + python scripts/validate_site.py --site-dir website/dist label-pr: runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index e8f9b3e0..d9051a43 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,8 @@ site/ *.log node_modules/ -# Generated site pages (built by generate_site.py, deployed in CI) +# Pages of the MkDocs build the site had before Astro Starlight: a clone may +# still hold them. The Starlight project ignores its own generated folders. docs/ # Large files stored as GitHub Release assets (> 50MB) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 06870fb9..6a70d00d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -59,8 +59,7 @@ validation above is its check. For code, profiles or platform files, these are the checks CI runs on a pull request (Python 3.12 or newer): ```bash -pip install pyyaml "jsonschema[format-nongpl]" markdown \ - "mkdocs-material>=9.7.5,<10" "pymdown-extensions>=10.14" +pip install pyyaml "jsonschema[format-nongpl]" markdown python scripts/validate_pr.py --changed # the BIOS files the branch adds python scripts/validate_schemas.py --source-only # profiles and platform files python scripts/profile_sync.py --changed --strict # each profile the branch adds or edits diff --git a/docs_assets/overrides/assets/brand/apple-touch-icon.png b/docs_assets/brand/apple-touch-icon.png similarity index 100% rename from docs_assets/overrides/assets/brand/apple-touch-icon.png rename to docs_assets/brand/apple-touch-icon.png diff --git a/docs_assets/overrides/assets/brand/favicon-32.png b/docs_assets/brand/favicon-32.png similarity index 100% rename from docs_assets/overrides/assets/brand/favicon-32.png rename to docs_assets/brand/favicon-32.png diff --git a/docs_assets/overrides/assets/brand/favicon.svg b/docs_assets/brand/favicon.svg similarity index 100% rename from docs_assets/overrides/assets/brand/favicon.svg rename to docs_assets/brand/favicon.svg diff --git a/docs_assets/overrides/assets/brand/logo.svg b/docs_assets/brand/logo.svg similarity index 100% rename from docs_assets/overrides/assets/brand/logo.svg rename to docs_assets/brand/logo.svg diff --git a/docs_assets/extra.css b/docs_assets/extra.css deleted file mode 100644 index fed41bb5..00000000 --- a/docs_assets/extra.css +++ /dev/null @@ -1,977 +0,0 @@ -/* RetroBIOS theme on top of mkdocs-material. - - Classes the generator and the wiki pages can use: - .rb-lead first paragraph under a page title - .rb-level-* level label (start, setup, explore, reference, contribute) - .rb-page-header logo or image beside the title block of an entity page - .rb-cards, .rb-card card grid without Material's list markup - .grid.cards Material card grid, restyled here - .rb-card-logo 40 px logo tile inside a card - .rb-steps ordered list drawn as numbered steps - .rb-terminal wraps a code block that shows terminal output - .rb-cmd wraps a command that must wrap instead of scrolling - code.rb-path a folder path shown as a chip - .rb-figure a generated diagram (scripts/sitediagrams.py) - .rb-bar inline coverage bar, width from --v -*/ - -:root { - --rb-primary: #3b3f7a; - --rb-primary-dark: #2b2e5c; - --rb-accent: #b42318; - --rb-link: #273c8f; - --rb-fg: rgba(0, 0, 0, 0.87); - --rb-surface: #f5f6fa; - --rb-border: #e0e3eb; - --rb-border-strong: #b8bdcc; - --rb-text-secondary: #546e7a; - --rb-ok-fg: #1b5e20; - --rb-ok-bg: #e8f5e9; - --rb-warn-fg: #a33f00; - --rb-warn-bg: #fff3e0; - --rb-err-fg: #b71c1c; - --rb-err-bg: #ffebee; - --rb-info-fg: #0d47a1; - --rb-info-bg: #e3f2fd; - --rb-muted-fg: #455a64; - --rb-muted-bg: #eceff1; - --rb-level-start: #1b5e20; - --rb-level-setup: #0d47a1; - --rb-level-explore: #6a1b9a; - --rb-level-reference: #455a64; - --rb-level-contribute: #a33f00; - --rb-terminal-bg: #1b1d2e; - --rb-terminal-fg: #e6e6f0; - --rb-terminal-label: #9aa0c3; - --rb-diagram-fill: #f5f6fa; - --rb-diagram-stroke: #8c92ac; - --rb-diagram-accent: #3b3f7a; - --md-code-font: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; -} - -[data-md-color-scheme="slate"] { - --rb-accent: #ff9a8f; - --rb-link: #aebcff; - --rb-fg: #e3e4ee; - --rb-surface: #252838; - --rb-border: #3a3d52; - --rb-border-strong: #5a5e7a; - --rb-text-secondary: #a6adc8; - --rb-ok-fg: #a5d6a7; - --rb-ok-bg: #1b3a1f; - --rb-warn-fg: #ffcc80; - --rb-warn-bg: #7a2e00; - --rb-err-fg: #ef9a9a; - --rb-err-bg: #7f1414; - --rb-info-fg: #90caf9; - --rb-info-bg: #0d2a55; - --rb-muted-fg: #cfd8dc; - --rb-muted-bg: #37474f; - --rb-level-start: #a5d6a7; - --rb-level-setup: #90caf9; - --rb-level-explore: #ce93d8; - --rb-level-reference: #cfd8dc; - --rb-level-contribute: #ffcc80; - --rb-terminal-bg: #12131c; - --rb-diagram-fill: #252838; - --rb-diagram-stroke: #7c82a3; - --rb-diagram-accent: #aebcff; -} - -/* Colour roles. The header keeps the brand indigo in both schemes: the - lighter indigo it used in dark mode left the tab labels at 3.5:1. */ -[data-md-color-scheme="default"] { - --md-primary-fg-color: var(--rb-primary); - --md-primary-fg-color--light: #4a4e8a; - --md-primary-fg-color--dark: var(--rb-primary-dark); - --md-accent-fg-color: var(--rb-accent); - --md-typeset-a-color: var(--rb-link); - /* Comments and punctuation sat at 4.47:1 on the code background. */ - --md-code-hl-comment-color: #5c5c5c; - --md-code-hl-generic-color: #5c5c5c; - --md-code-hl-variable-color: #5c5c5c; - --md-code-hl-operator-color: #5c5c5c; - --md-code-hl-punctuation-color: #5c5c5c; -} - -[data-md-color-scheme="slate"] { - --md-primary-fg-color: var(--rb-primary-dark); - --md-primary-fg-color--light: var(--rb-primary); - --md-primary-fg-color--dark: #1f2147; - --md-accent-fg-color: var(--rb-accent); - --md-accent-bg-color: #1e2129; - --md-typeset-a-color: var(--rb-link); - --md-code-hl-constant-color: #b39ddb; -} - -/* Type scale: the page title is the strongest heading on the page. */ -.md-typeset h1 { - color: var(--md-default-fg-color); - font-size: 2em; - font-weight: 700; - letter-spacing: -0.01em; - line-height: 1.25; - margin: 0 0 0.9em; -} - -.md-typeset h2 { - font-size: 1.45em; - font-weight: 600; - letter-spacing: -0.005em; - margin-top: 2em; -} - -.md-typeset h3 { - font-size: 1.15em; - font-weight: 600; -} - -.md-typeset h4 { - font-weight: 600; -} - -.md-typeset .rb-lead { - font-size: 1.05em; - line-height: 1.55; - max-width: 44em; -} - -/* Level label under a page title */ -.rb-level { - display: inline-block; - margin: 0 0 0.8rem; - padding: 0.05rem 0.45rem; - border: 1px solid currentColor; - border-radius: 2px; - font-size: 0.68rem; - font-weight: 600; - letter-spacing: 0.01em; - line-height: 1.6; - color: var(--rb-level-reference); -} - -.rb-level-start { color: var(--rb-level-start); } -.rb-level-setup { color: var(--rb-level-setup); } -.rb-level-explore { color: var(--rb-level-explore); } -.rb-level-reference { color: var(--rb-level-reference); } -.rb-level-contribute { color: var(--rb-level-contribute); } - -/* Header block of platform, system and emulator pages */ -.rb-page-header { - display: grid; - grid-template-columns: 56px 1fr; - gap: 0.4rem 1rem; - align-items: center; - margin: 0 0 1.2rem; -} - -.rb-page-header > :first-child img, -.rb-page-header > img { - width: 56px; - height: 56px; - object-fit: contain; -} - -.md-typeset .rb-page-header h1 { - margin: 0; -} - -.rb-page-header p { - margin: 0.2rem 0 0; -} - -/* A page that names its logo next to the title floats it right; the logo - keeps its own box instead of shifting the counters below. */ -.md-typeset img[align="right"] { - width: 56px; - height: 56px; - object-fit: contain; - margin: 0 0 0.6rem 1rem; - padding: 4px; - border: 1px solid var(--rb-border); - border-radius: 4px; - background: #fff; -} - -/* Logos are drawn for a light background: they keep one in dark mode. */ -.md-typeset img[src*="assets/logos/"] { - padding: 2px; - border-radius: 2px; - background: #fff; -} - -/* Headline figures, read as one line of numbers: four fit on one row of - the text column. */ -.rb-stats { - display: grid; - grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); - gap: 0.6rem 1rem; - margin: 1rem 0 1.5rem; - padding: 0.8rem 1rem; - border: 1px solid var(--rb-border); - border-radius: 4px; - background: var(--rb-surface); -} - -.md-typeset .rb-stat p { - margin: 0; -} - -.rb-stat .rb-stat-value { - font-size: 1.25rem; - font-weight: 700; - display: block; - font-variant-numeric: tabular-nums; -} - -.rb-stat .rb-stat-label { - font-size: 0.75rem; - color: var(--rb-text-secondary); - display: block; -} - -.rb-badge { - display: inline-block; - padding: 0 0.4em; - border-radius: 2px; - font-size: 0.75rem; - font-weight: 600; - line-height: 1.6; - white-space: nowrap; -} - -.rb-badge-success { background: var(--rb-ok-bg); color: var(--rb-ok-fg); } -.rb-badge-warning { background: var(--rb-warn-bg); color: var(--rb-warn-fg); } -.rb-badge-danger { background: var(--rb-err-bg); color: var(--rb-err-fg); } -.rb-badge-info { background: var(--rb-info-bg); color: var(--rb-info-fg); } -.rb-badge-muted { background: var(--rb-muted-bg); color: var(--rb-muted-fg); } - -/* A link inside a badge keeps the badge's tested colour pair. */ -.md-typeset .rb-badge a:not(.md-button), -.md-typeset a.rb-badge { - color: inherit; -} - -/* Inline code inside a link reads as a link in both schemes. */ -.md-typeset a code { - color: var(--rb-link); -} - -/* Tables */ -.md-typeset table:not([class]) { - font-variant-numeric: tabular-nums; -} - -.md-typeset table:not([class]) th { - position: sticky; - top: 0; - z-index: 1; - font-weight: 600; -} - -.md-typeset table:not([class]) th, -.md-typeset table:not([class]) td { - padding: 0.55em 0.9em; -} - -.md-typeset__scrollwrap { - margin: 1rem 0; -} - -/* A table lines up with the text around it. Material indents the table - by 0.8rem and offsets that with a negative margin on the wrapper, which - the margin above removes, and the table's own margin doubled the space - above it. */ -.md-typeset .md-typeset__table { - padding: 0; -} - -.md-typeset .md-typeset__table > table { - margin: 0; -} - -.rb-timestamp { - font-size: 0.8rem; - color: var(--rb-text-secondary); - margin-top: 2rem; - padding-top: 1rem; - border-top: 1px solid var(--rb-border); -} - -/* One block per file on emulator and system pages, separated by a rule */ -.rb-file-entry, -.rb-sys-file { - border-top: 1px solid var(--rb-border); - padding: 0.75rem 0 0.25rem; - margin: 0; -} - -.rb-file-entry > p:first-child, -.rb-sys-file > p:first-child { - margin-top: 0; -} - -.rb-file-header code { - font-size: 0.95rem; - font-weight: 700; -} - -/* A card's title is a heading so the search lands on it, set as body text */ -.md-typeset .rb-file-title { - margin: 0 0 0.3rem; - font-size: inherit; - font-weight: 400; - letter-spacing: normal; - scroll-margin-top: 4rem; -} - -.md-typeset .rb-file-title code { - font-weight: 700; -} - -/* Lines the search skips continue the card's list */ -.rb-search-skip > ul { - margin-top: 0.1rem; -} - -.rb-file-entry ul, -.rb-sys-file ul { - margin: 0.3rem 0 0; - padding-left: 1.2rem; - font-size: 0.85rem; -} - -.rb-file-entry li, -.rb-sys-file li { - margin: 0.1rem 0; -} - -/* Hashes are printed whole so the search finds them, and wrap on phones */ -.rb-hash { - font-family: var(--md-code-font); - font-size: 0.78rem; - color: var(--rb-text-secondary); - overflow-wrap: anywhere; -} - -/* Key and value cards: the header row is empty, so it is not drawn and - not announced. */ -.rb-meta-card thead, -.md-typeset table thead:not(:has(th:not(:empty))) { - display: none; -} - -.rb-meta-card td { - overflow-wrap: anywhere; -} - -.rb-meta-card td:first-child { - font-weight: 600; - color: var(--rb-text-secondary); - white-space: nowrap; - width: 140px; -} - -.md-typeset table .md-button { - font-size: 0.75rem; - min-height: 44px; - padding: 0.55em 0.8em; -} - -/* Buttons. The dark scheme draws them in the link colour: the header indigo - would sit at 3:1 on the page. */ -[data-md-color-scheme="slate"] .md-typeset .md-button { - color: var(--rb-link); - border-color: var(--rb-link); -} - -[data-md-color-scheme="slate"] .md-typeset .md-button--primary { - background-color: var(--rb-link); - color: #1e2129; -} - -[data-md-color-scheme="slate"] .md-typeset .md-button:is(:hover, :focus) { - background-color: var(--rb-accent); - border-color: var(--rb-accent); - color: #1e2129; -} - -.md-typeset a:not(.md-button):not(.headerlink):not(.rb-badge) { - color: var(--rb-link); - text-decoration: underline; - text-decoration-thickness: 0.08em; - text-underline-offset: 0.14em; -} - -.md-typeset a:not(.md-button):not(.headerlink):hover { - text-decoration-thickness: 0.14em; -} - -:where(a, button, input, select, textarea, label, [tabindex]):focus-visible { - outline: 3px solid var(--rb-accent); - outline-offset: 3px; -} - -.md-typeset .md-button, -.md-typeset button, -.md-typeset input, -.md-typeset select { - min-height: 44px; -} - -/* Buttons that wrap onto a second line keep a gap between the rows. */ -.md-typeset .md-button { - margin-block: 0.25rem; -} - -/* The copy button stays inside a one-line code block: at 44 px it hung - below the block and covered the end of the line. 24 px is the minimum - target size of WCAG 2.2. */ -.md-typeset .md-code__button { - min-height: 0; - width: 24px; - height: 24px; -} - -.md-typeset pre > code { - padding-right: 2.6rem; -} - -.rb-visually-hidden { - position: absolute !important; - width: 1px !important; - height: 1px !important; - padding: 0 !important; - margin: -1px !important; - overflow: hidden !important; - clip: rect(0, 0, 0, 0) !important; - white-space: nowrap !important; - border: 0 !important; -} - -.rb-table-filter { - display: grid; - grid-template-columns: minmax(14rem, 28rem) auto; - gap: 0.35rem 0.8rem; - align-items: end; - margin: 1rem 0 0.45rem; -} - -.rb-table-filter label { - grid-column: 1 / -1; - color: var(--rb-text-secondary); - font-size: 0.78rem; - font-weight: 700; -} - -.rb-table-filter input { - width: 100%; - border: 1px solid var(--rb-text-secondary); - border-radius: 2px; - background: var(--md-default-bg-color); - color: var(--md-default-fg-color); - padding: 0.55rem 0.75rem; - font: inherit; -} - -.rb-table-filter-count { - align-self: center; - color: var(--rb-text-secondary); - font-size: 0.8rem; - white-space: nowrap; -} - -.md-typeset__scrollwrap[role="region"]:focus-visible { - outline: 3px solid var(--rb-accent); - outline-offset: 2px; -} - -/* Admonitions: one meaning per colour. - blue note, info, abstract, example, question, quote: background - teal tip: a shortcut - green success: what it looks like when it worked - orange warning: a risk of losing data or using the wrong file - red danger, failure, bug: something is broken or refused */ -.md-typeset :is(.admonition, details):is(.info, .abstract, .example, .question, .quote, .note) { - border-color: #448aff; -} - -.md-typeset :is(.info, .abstract, .example, .question, .quote, .note) > :is(.admonition-title, summary) { - background-color: rgba(68, 138, 255, 0.1); -} - -.md-typeset :is(.info, .abstract, .example, .question, .quote, .note) > :is(.admonition-title, summary)::before { - background-color: #448aff; - -webkit-mask-image: var(--md-admonition-icon--info); - mask-image: var(--md-admonition-icon--info); -} - -.md-typeset :is(.admonition, details).tip { - border-color: #00897b; -} - -.md-typeset .tip > :is(.admonition-title, summary) { - background-color: rgba(0, 137, 123, 0.1); -} - -.md-typeset .tip > :is(.admonition-title, summary)::before { - background-color: #00897b; - -webkit-mask-image: var(--rb-icon-shortcut); - mask-image: var(--rb-icon-shortcut); -} - -.md-typeset :is(.admonition, details):is(.danger, .failure, .bug, .error) { - border-color: #d32f2f; -} - -.md-typeset :is(.danger, .failure, .bug, .error) > :is(.admonition-title, summary) { - background-color: rgba(211, 47, 47, 0.1); -} - -.md-typeset :is(.danger, .failure, .bug, .error) > :is(.admonition-title, summary)::before { - background-color: #d32f2f; - -webkit-mask-image: var(--md-admonition-icon--danger); - mask-image: var(--md-admonition-icon--danger); -} - -:root { - --rb-icon-shortcut: url('data:image/svg+xml;charset=utf-8,'); -} - -/* Code: shell commands wrap so the whole command shows on a phone, and the - copy button keeps its own column instead of covering the end. */ -.md-typeset :is(.language-sh, .language-bash, .language-shell, .language-console, - .language-powershell, .language-ps1, .language-pwsh, .language-cmd, .language-bat) pre > code, -.md-typeset .rb-cmd pre > code { - white-space: pre-wrap; - overflow-wrap: anywhere; - padding-right: 2.6rem; -} - -/* Terminal output: what the screen shows, not something to type */ -.md-typeset .rb-terminal pre, -.md-typeset .rb-terminal pre > code { - background: var(--rb-terminal-bg); - color: var(--rb-terminal-fg); -} - -.md-typeset .rb-terminal pre { - border: 1px solid var(--rb-border); - border-radius: 4px; -} - -.md-typeset .rb-terminal pre::before { - content: "Terminal output"; - display: block; - padding: 0.5rem 1.2em 0; - font: 600 0.65rem var(--md-text-font-family); - color: var(--rb-terminal-label); -} - -.md-typeset .rb-terminal .md-code__button { - color: var(--rb-terminal-label); -} - -/* Numbered steps */ -.md-typeset ol.rb-steps, -.md-typeset .rb-steps > ol { - counter-reset: rb-step; - list-style: none; - margin-left: 0; - padding-left: 0; -} - -.md-typeset ol.rb-steps > li, -.md-typeset .rb-steps > ol > li { - counter-increment: rb-step; - position: relative; - margin: 0 0 1.2rem; - padding-left: 2.6rem; - min-height: 1.8rem; -} - -.md-typeset ol.rb-steps > li::before, -.md-typeset .rb-steps > ol > li::before { - content: counter(rb-step); - position: absolute; - top: 0; - left: 0; - width: 1.8rem; - height: 1.8rem; - border-radius: 4px; - background: var(--md-primary-fg-color); - color: #fff; - font-weight: 700; - line-height: 1.8rem; - text-align: center; -} - -[data-md-color-scheme="slate"] .md-typeset ol.rb-steps > li::before, -[data-md-color-scheme="slate"] .md-typeset .rb-steps > ol > li::before { - background: var(--rb-link); - color: #1e2129; -} - -/* Card grids. Material's grid cards keep their markup; the hover shadow - gives way to a stronger border. */ -.md-typeset .grid.cards { - --md-shadow-z2: 0 0 #0000; -} - -.md-typeset .grid.cards > :is(ul, ol) > li, -.md-typeset .grid > .card { - border: 1px solid var(--rb-border); - border-radius: 4px; -} - -.md-typeset .grid.cards > :is(ul, ol) > li:is(:hover, :focus-within), -.md-typeset .grid > .card:is(:hover, :focus-within) { - border-color: var(--rb-border-strong); -} - -.rb-cards { - display: grid; - grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); - gap: 0.8rem; - margin: 1rem 0 1.5rem; -} - -.rb-card { - display: flex; - flex-direction: column; - gap: 0.35rem; - padding: 0.8rem; - border: 1px solid var(--rb-border); - border-radius: 4px; - background: var(--md-default-bg-color); -} - -.rb-card:is(:hover, :focus-within) { - border-color: var(--rb-border-strong); -} - -.md-typeset .rb-card p { - margin: 0; -} - -.md-typeset .rb-card .md-button { - margin-top: auto; - align-self: flex-start; -} - -.md-typeset .rb-card-logo, -.md-typeset .grid.cards img.rb-card-logo { - width: 40px; - height: 40px; - object-fit: contain; - padding: 4px; - border: 1px solid var(--rb-border); - border-radius: 4px; - background: #fff; - vertical-align: middle; -} - -/* Path chip */ -.md-typeset code.rb-path { - padding: 0.15rem 0.45rem; - border: 1px solid var(--rb-border); - border-radius: 2px; - font-size: 0.8em; - overflow-wrap: anywhere; -} - -/* Content tabs (operating systems): the selected tab reads clearly. */ -.md-typeset .tabbed-labels > label { - font-size: 0.75rem; - font-weight: 600; - color: var(--rb-text-secondary); -} - -.md-typeset .tabbed-set > input:checked + label, -.md-typeset .tabbed-labels > label:hover { - color: var(--rb-link); -} - -.md-typeset .tabbed-labels::before { - background: var(--rb-link); -} - -/* Inline coverage bar beside a number */ -.rb-bar { - display: inline-block; - width: 5rem; - height: 0.4rem; - margin-right: 0.4rem; - border-radius: 2px; - background: var(--rb-border); - vertical-align: middle; -} - -.rb-bar > span { - display: block; - width: var(--v, 0%); - height: 100%; - border-radius: 2px; - background: var(--rb-ok-fg); -} - -/* Diagrams written by scripts/sitediagrams.py. Text takes the page font and - colour, boxes take the theme surface, so the drawing follows the palette - toggle. Each diagram carries a wide and a narrow layout. */ -.md-typeset .rb-figure { - margin: 1.2rem 0 1.6rem; -} - -.md-typeset .rb-figure svg { - display: block; - width: 100%; - height: auto; - max-width: 52rem; - color: var(--md-default-fg-color); -} - -.md-typeset .rb-figure figcaption { - max-width: 44em; - margin: 0.4rem 0 0; - font-size: 0.75rem; - font-style: normal; - color: var(--rb-text-secondary); - text-align: left; -} - -.rb-diagram text { - font-family: var(--md-text-font-family); - fill: currentColor; -} - -.rb-diagram .rb-d-box { - fill: var(--rb-diagram-fill); - stroke: var(--rb-diagram-stroke); -} - -.rb-diagram .rb-d-accent { - stroke: var(--rb-diagram-accent); -} - -.rb-diagram .rb-d-line { - stroke: var(--rb-diagram-stroke); -} - -.rb-diagram .rb-d-head { - fill: var(--rb-diagram-stroke); -} - -.rb-diagram .rb-d-num { - fill: var(--rb-diagram-accent); -} - -.rb-diagram .rb-d-numtext { - fill: var(--md-default-bg-color); -} - -.rb-diagram .rb-d-muted { - fill: var(--rb-text-secondary); -} - -.rb-diagram-narrow { - display: none !important; -} - -@media (max-width: 37.5em) { - .rb-diagram-wide { - display: none !important; - } - - .rb-diagram-narrow { - display: block !important; - } -} - -/* The sidebar title stays legible over the list scrolling under it. With - tabs the title shown is the active section's label, held at the top of - the sidebar: a rule under it ends the list cleanly instead of a half - line of text touching the label. */ -@media (min-width: 76.25em) { - .md-nav--primary > .md-nav__title, - .md-nav--secondary > .md-nav__title, - .md-nav--lifted > .md-nav__list > .md-nav__item--active > .md-nav__link { - background: var(--md-default-bg-color); - border-bottom: 1px solid var(--rb-border); - } - - .md-nav--lifted > .md-nav__list > .md-nav__item--active > .md-nav__link { - padding-bottom: 0.4rem; - } -} - -/* Material's compact footer defaults sit just below WCAG AA on the dark bar. */ -.md-footer-meta .md-copyright { - color: #b5b5b5; -} - -.md-footer-meta.md-typeset .md-copyright a { - color: #b8c6ff !important; -} - -/* 404 page */ -.rb-notfound-search { - display: inline-flex; - align-items: center; - min-height: 44px; - padding: 0.55em 1.2em; - border: 1px solid currentColor; - border-radius: 2px; - color: var(--rb-link); - font-weight: 700; - cursor: pointer; -} - -@media (max-width: 44.984375em) { - /* Tables with an action column become one block per row, so the button - is never behind a horizontal scroll (site.js marks them). */ - .md-typeset__table:has(table[data-rb-stack]) { - display: block; - } - - .md-typeset table[data-rb-stack] { - display: block; - width: 100%; - } - - .md-typeset table[data-rb-stack] thead { - position: absolute; - width: 1px; - height: 1px; - overflow: hidden; - clip: rect(0, 0, 0, 0); - } - - .md-typeset table[data-rb-stack] tbody, - .md-typeset table[data-rb-stack] tr { - display: block; - } - - .md-typeset table[data-rb-stack] tr { - padding: 0.5rem 0; - border-top: 1px solid var(--rb-border); - } - - .md-typeset table[data-rb-stack] td { - display: block; - position: relative; - min-height: 1.6rem; - padding: 0.25rem 0.6rem 0.25rem 8.4rem; - border: 0; - text-align: left !important; - overflow-wrap: anywhere; - } - - .md-typeset table[data-rb-stack] td::before { - content: attr(data-label); - position: absolute; - top: 0.25rem; - left: 0.6rem; - width: 7.4rem; - font-weight: 600; - color: var(--rb-text-secondary); - } - - .md-typeset table[data-rb-stack] td .md-button { - margin: 0 0.3rem 0.3rem 0; - } - - .md-typeset table[data-rb-stack] td:empty { - display: none; - } - - /* Other wide tables scroll with their first column held in place. */ - .md-typeset table:not([class]):not([data-rb-stack]) :is(td, th):first-child { - position: sticky; - left: 0; - min-width: min(6rem, 30vw); - max-width: 40vw; - background: var(--md-default-bg-color); - overflow-wrap: break-word; - } - - /* A long link or path breaks anywhere, so it never squeezes the first - column down to one letter per line. */ - .md-typeset table:not([class]):not([data-rb-stack]) td:not(:first-child) :is(a, code) { - overflow-wrap: anywhere; - } - - .md-typeset table:not([class]):not([data-rb-stack]) th:first-child { - z-index: 2; - } - - /* On a phone every command wraps: the end of a one-liner (the "| sh" - that makes it work) is never off-screen. Terminal output keeps its - columns and scrolls. */ - .md-typeset pre > code { - white-space: pre-wrap; - overflow-wrap: anywhere; - } - - .md-typeset :is(.rb-terminal, .language-text) pre > code { - white-space: pre; - overflow-wrap: normal; - } - - /* Text on reference pages stays at 12 px or more on a phone. */ - .rb-file-entry ul, - .rb-sys-file ul, - .rb-hash { - font-size: 0.75rem; - } - - .rb-page-header { - grid-template-columns: 1fr; - } -} - -@media (max-width: 600px) { - .rb-table-filter { - grid-template-columns: 1fr; - } - - .rb-table-filter label { - grid-column: auto; - } - - .rb-stats { - grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr)); - } - - .rb-stat .rb-stat-value { - font-size: 1.1rem; - } -} - -@media (prefers-reduced-motion: reduce) { - *, - *::before, - *::after { - scroll-behavior: auto !important; - transition-duration: 0.01ms !important; - animation-duration: 0.01ms !important; - animation-iteration-count: 1 !important; - } -} - -/* A file block can be cited by URL: its link shows on hover, and the block a - link lands on is marked. */ -.rb-permalink { - margin-left: 0.4rem; - color: var(--md-default-fg-color--light, var(--rb-border)); - text-decoration: none; - opacity: 0; -} -.rb-file-entry:hover .rb-permalink, -.rb-sys-file:hover .rb-permalink, -.rb-permalink:focus { - opacity: 1; -} -.rb-file-entry:has(> .rb-file-title:target), -.rb-sys-file:has(> .rb-file-title:target) { - background: var(--rb-surface); -} diff --git a/docs_assets/overrides/404.html b/docs_assets/overrides/404.html deleted file mode 100644 index 59ad2c3d..00000000 --- a/docs_assets/overrides/404.html +++ /dev/null @@ -1,37 +0,0 @@ -{% extends "main.html" %} - -{# - The page a stale link lands on. Pages have moved before (file cards - refiled between manufacturers), so it offers the search, the two pages a - visitor most often wants, and the list a moved emulator, system or - platform page belongs to. -#} -{% block content %} -
This address has no page. It may have moved since the link was written.
- -{html.escape(m[1], quote=False)}", text)
ident = f' id="{anchor}"' if anchor else ""
- # The card is the file's own page in all but name: its title weighs
- # as a page title does, so a file name typed in the search finds
- # the card before a guide that cites it as an example.
- weight = ' data-pagefind-weight="7"' if searchable else f" {markup.search_exclude()}"
- return f'(.*?)", card[2])
names.append(match[1] if match[1] is not None else html.unescape(match[2]))
if len(names) == 1:
@@ -4025,7 +4042,7 @@ def _render_emulator_file(
lines.append(markup.block_open("div", 'class="rb-file-entry"'))
lines.append("")
marker = f'' if alias else ""
- lines.append(_card_title(f"{marker}{_code(fname)} {badge_str}", anchor))
+ lines.append(_card_title(f"{marker}{_code(fname)} {badge_str}", anchor, weight=5))
lines.append("")
if desc:
lines.extend([_escape_tags(str(desc)), ""])
@@ -4845,7 +4862,7 @@ def emulator_pages(
# The member tables are a file list with hashes: out of the search,
# dolphin, primehack and ishiiruka each put 210 KB of it there.
lines.extend([
- "## Data directories" + (" { data-search-exclude }" if not markup.starlight() else ""),
+ "## Data directories",
"",
])
trees_start = len(lines)
@@ -4895,10 +4912,8 @@ def emulator_pages(
"info", f"{_count(len(members), 'file')}, as the packs ship them",
table, indent=" "))
lines.append("")
- if markup.starlight():
- # The member tables are the lookup's, as the heading's attribute
- # keeps them under MkDocs.
- lines[trees_start:] = search_excluded(lines[trees_start:])
+ # The member tables are the lookup's.
+ lines[trees_start:] = search_excluded(lines[trees_start:])
lines.extend(_next_block([
"[Get your files](../which-pack.md), for the setup you play on",
@@ -6125,23 +6140,7 @@ def _system_emulators(
if names & data.get("names", set())]
-def _mkdocs_config(docs: Path, text: str) -> tuple[Path, str]:
- """Where the site's config goes, and its text for that place.
-
- The tracked mkdocs.yml belongs to docs/. A preview into another folder
- rewrote it anyway, with the navigation of work in progress, and mkdocs
- kept reading docs/. Another folder gets its own config beside it, its
- paths taken from there.
- """
- if os.path.normpath(str(docs)) == DOCS_DIR:
- return Path("mkdocs.yml"), text
- where = docs.parent
- for relative in ("scripts/mkdocs_hooks.py", "docs_assets/overrides"):
- text = text.replace(relative, os.path.relpath(relative, where).replace(os.sep, "/"))
- return where / f"{docs.name}.mkdocs.yml", f"docs_dir: {docs.name}\n" + text
-
-
-# mkdocs.yml nav generator
+# Navigation
_OS_NAMES = {"windows": "Windows", "darwin": "macOS", "linux": "Linux"}
@@ -6332,13 +6331,10 @@ def generate_which_pack() -> str:
"",
"Run the command and press **c** when it asks.",
"",
- *([
- "Or choose your setup and consoles here. You get the list of files "
- "and a command that installs only those.",
- "",
- "([^<]+)')
+
+
+def file_names_meta(body: str) -> str:
+ """The names of the files a system page holds cards for, as a search
+ field of the page. A page of 250 cards is long, and the search weighs a
+ long page down: the Sony page, where scph5501.bin is downloaded, came
+ after every short page citing the name. The field is weighted in the
+ site's ranking (astro.config.mjs, metaWeights.files)."""
+ names = sorted({unescape(name) for name in _CARD_NAME.findall(body)})
+ if not names:
+ return ""
+ return f'\n{html.escape(" ".join(names))}\n'
+
+
def finalize_page(
rel: str,
markdown: str,
*,
level: str,
- boost: int | None,
+ weight: float | None,
browser_title: str,
description: str,
structured: dict,
@@ -375,6 +391,8 @@ def finalize_page(
# is a name, and stays: it is how "neogeo.zip" finds the cores reading it.
body = re.sub(r' *)(?P{md5}', text)
class AMismatchNamesTheDumpTheCollectionHolds(unittest.TestCase):
@@ -924,12 +925,14 @@ class NestedProfileBlocksRenderAsLists(unittest.TestCase):
lines = generate_site._render_platform_details(
{"platform_details": {"megacd": {"root": "x"}, "note": "y"}}
)
- lines[0] = lines[0].replace("???+", "!!!")
try:
import markdown
except ImportError:
self.skipTest("markdown is not installed")
- html = markdown.markdown("\n".join(lines), extensions=["admonition"])
+ # The block's body, read as the engine reads Markdown inside HTML.
+ body = lines[lines.index("a.bin", searched)
self.assertNotIn("- MD5:", searched)
- for line in ("- MD5:", "- Emulators:", "- Platforms:", "- Also installed by:"):
+ for line in ("- MD5:", "- Emulators:", "- Also installed by:"):
self.assertIn(line, skipped)
+ # The platforms line names the file as each setup does: the site
+ # search reads it, so a file name finds its card.
+ self.assertIn("- Platforms:", searched + skipped.split("