Skip to content

Website

github-actions[bot] edited this page Nov 28, 2026 · 2 revisions

Website

Role. omnisnap.org is the project's public site: a landing page, the user guides, a live demo report and the JSON Schemas. Every page on it describes one release, the one it was built from. Module website, built by tools/site/build.py and served by the omnisnap-schemas Cloudflare Worker.

What it serves

Path Content Built from
/ Landing page: a hero figure of one real finding, the engines, features, how it works, the report screenshot, install, the Action snippet site/index.html, with the release's version substituted
/docs/ The three guides as cards, with the one-line summaries in GUIDE_SUMMARIES generated
/docs/<slug>/ The quick start, the Action setup guide, fork comments, each with the guide sidebar and "On this page" docs/*.md at the release tag, rendered by GitHub
/demo/ A report captured during the deploy, and its screenshots the omnisnap-merged artifact of the deploy run
/schema/, /schema/<name>/<major>.json The schema list (a card per schema: title, URL, the first sentence of description), and each schema at the path its $id names schema/
/404.html "Nothing measured here", with links to Home, Docs and Demo generated
/site.css The one stylesheet site/site.css
/site.js The one script, only conveniences (see Script) site/site.js
/fonts/ IBM Plex Sans 400, 400 italic and 600 and IBM Plex Mono 400, Latin-1 WOFF2 subsets, and OFL.txt site/fonts/
/img/report.webp The report screenshot on / site/img/report.webp
/favicon.svg, /favicon.ico The tab icon: every generated page links the SVG; browsers ask for the .ico on pages without an icon link, such as the demo site/favicon.svg, site/favicon.ico

The build

python3 tools/site/build.py --version <tag> [--demo <merged-dir>] [--out _site] [--skip-docs]

build runs these steps in order. It uses the Python standard library only, and any BuildError exits with status 1.

  1. Versions. versions turns the tag into its three spellings: v0.1.0-rc.7 for the binary and the Action, 0.1.0-rc.7 for npm, and 0.1.0rc7 for PyPI (PEP 440). A string that isn't a release tag is an error.
  2. The demo check, first. With --demo, compared_anything must find a summary.json with at least one result whose status is not failed or unreachable. Otherwise the build stops before writing anything: "the demo compared nothing".
  3. A clean output. _site/ is deleted and recreated, so nothing from an earlier build is uploaded.
  4. Landing page. build_landing substitutes {{version}}, {{npm_version}} and {{pypi_version}} in site/index.html; an unknown placeholder is an error. It wraps the result in the shared page template. copy_assets then copies every path in ASSETS (the stylesheet, the script, the tab icons, the fonts and their licence, the report screenshot) from site/; a missing one is a BuildError ("site/ is missing …").
  5. Schemas and 404. build_schemas copies each schema/*.schema.json to the path after omnisnap.org/ in its $id, as the previous schema-only site did, and writes the list at /schema/: a card per schema with its title, its URL and first_sentence(description) (the text up to the first ". " outside parentheses). build_404 writes the not-found page.
  6. Docs. build_docs renders each guide in GUIDES (described in the next section).
  7. Demo. build_demo copies the merged bundle's report.html to /demo/index.html, plus only the screenshots its summary.json names (results[].shots.baseline.src and .engine.src), keeping their relative paths. Captures, probes and findings are never published. A screenshot path that is absolute or contains .. is refused, and so is one the bundle doesn't hold.

Every page except the demo uses page. In <head>: the inline theme script (THEME_SCRIPT), the tab icon, a preload of the body font, the stylesheet and <script src="/site.js" defer>. In <body>: a skip link, the header (the inlined logo mark, the nav to Demo, Docs, Schemas and GitHub, and the theme switch, hidden until the script shows it), <main id="main">, and the footer (what Omnisnap is, the release it was built from with a link to its GitHub release, and the Product and Project links).

Rendering the docs

The guides are rendered by GitHub itself, so they look as they do on github.com: github_renderer requests repos/GerMP21/Omnisnap/contents/<path>?ref=<tag> with Accept: application/vnd.github.html and the workflow token. Any response other than 200 fails the build. The HTML then goes through four steps:

  • article keeps the <article class="markdown-body"> and drops GitHub's file wrapper.

  • rewrite_links rewrites each <a href>:

    • a link to another guide becomes its /docs/<slug>/ page, with the fragment kept;
    • any other relative path becomes the file on GitHub at the tag (blob/, or tree/ for a directory);
    • absolute URLs and #fragments are kept as they are;
    • a link to a path that doesn't exist, or one that leaves the repository, fails the build.

    Only <a> tags are matched, so a href="…" written inside a code block is never touched: GitHub escapes or splits it there.

  • fix_anchors strips GitHub's user-content- prefix from id and name. github.com maps #x to user-content-x with JavaScript, and the site must work without it, so the ids carry the plain slug and #x links work.

  • focusable adds tabindex="0" to every <pre> and <markdown-accessiblity-table>. Both scroll sideways on a narrow screen, and a keyboard user can only scroll what they can focus (WCAG 2.1.1; axe's scrollable-region-focusable). GitHub does this with script. The landing page's own <pre>s carry the attribute in site/index.html.

build_docs then lays each guide out in div.doc-layout: guide_nav (the three guides from GUIDES, the current one with aria-current="page"), "On this page", and the article with a link to its source. "On this page" comes from toc: each h2 and h3 with the id GitHub put on the <a class="anchor"> right after it, and its text without markup; toc_html nests the h3s under their h2. A heading with no id, or a guide with no h2, fails the build. The grid has three columns from 1100 px; below that "On this page" is a closed <details> above the article and the guide list is a row of links.

The saved response tools/site/testdata/github-action-setup.html is what the tests run on. It shows the markup these steps rely on: headings with an <a id="user-content-…" class="anchor">, tables inside <markdown-accessiblity-table> (GitHub's spelling), and code inside .highlight with pl-* spans.

--skip-docs builds without the network, for a local preview. The deploy never passes it.

Styles

site/site.css is the only stylesheet, with no third-party CSS. Its look ("Blueprint") comes from the logo and from what Omnisnap does, measuring:

  • Tokens on :root: --ink, --paper, --surface, --line, --primary (the logo's #0A5BB5; #4199F0 in the dark theme) and --diff, the amber for what differs (#a14a08 light, #f5a524 dark). Every text colour passes WCAG AA on every background it is used on; #a14a08 was picked by that check (the first choice, #b45309, was 4.46:1 on --surface-2).
  • Themes. The dark set applies under @media (prefers-color-scheme: dark) when no choice is stored (:root:not([data-theme="light"])), and under :root[data-theme="dark"] when the visitor chose it.
  • Motifs: .ticked (corner ticks on cards), .dim (a dimension line behind a section label) and .gridded (a faint grid behind the hero and the closing band).
  • Fonts: IBM Plex Sans and Mono from site/fonts/, font-display: swap, with system fonts as the fallback.
  • Visible focus rings, prefers-reduced-motion, and print styles.

It styles the GitHub markup the guides produce: tables scroll sideways inside their wrapper on a narrow screen, and it colours the common pl-* highlight classes. The demo keeps the viewer's own styles.

Script

site/site.js is plain JavaScript with no build step. Every page is complete without it; it adds:

  • The theme switch: shows the button, flips data-theme on <html> and stores the choice as omnisnap-theme. THEME_SCRIPT in <head> applies a stored choice before the first paint, so pages don't flash.
  • Copy buttons on every pre, only where navigator.clipboard exists in a secure context. The copied text drops leading $ prompts.
  • The install tabs: a [data-tabs] box of .tab-panel sections, each headed by an h3, becomes a WAI-ARIA tablist (arrow keys, Home, End). The choice is stored as omnisnap-tab-<id>. Without the script the panels are three headed sections, all visible.
  • The current section in "On this page": an IntersectionObserver sets aria-current on the last heading above the header line. On narrow screens it also closes the <details>.

Every localStorage access is in try/catch, so a private window or blocked storage only loses the remembered choices.

The hero and the screenshot

Both show the same real finding from a release run, so they must be refreshed together when the demo changes:

  • The hero SVG in site/index.html draws "article.card wraps differently" on corrosion-vst.org, Chrome against WebKitGTK on Linux, from the omnisnap-merged artifact of release run 46175620749 (v0.2.0-rc.4). The numbers come from linux-amd64/corrosion-vst.org/findings.json: the wrap cause whose selector is main > section.tour:nth-of-type(2) > div.cards > article.card:nth-of-type(1) > p:nth-of-type(2). Its boxes give 206×162.8 px in Chrome and 206×138 px in WebKitGTK, and delta gives dh −24.8 and dln −1. The line counts (7 and 6) are the heights over the paragraph's 23.25 px line height. Firefox agrees with Chrome (consensus: engine-odd), as the caption says. To refresh: gh run download <run> -n omnisnap-merged, read the same fields, and update the SVG's text, the pane heights and the caption.
  • The screenshot site/img/report.webp is the viewer on that result (#r4 in that bundle). It was taken from a copy of the bundle's report.html with a <style> that hides #summary, #host-selector, .host-header, .page-header, .page-url, every other result, the causes after the first, the info causes, .intent and .audit. Headless Chrome took it at 1280×800 CSS px with --force-device-scale-factor=2 and light theme, and cwebp -q 75 -m 6 converted it (123 KB). A fragment in the URL doesn't scroll in --screenshot, which is why the copy hides the rest instead.

Deploy

 tag push v*                                  Actions -> Deploy the website
     |                                                 (optional tag)
     v                                                      |
 release.yml: release (test, build, publish, verify)        |
              deploy  --uses-->  deploy.yml  <--------------+
                                   resolve: credentials? tag? site/ at the tag?
                                   demo:    report.yml (Linux, Windows, macOS),
                                            four demo pages, version = tag
                                   site:    checkout tag, download omnisnap-merged,
                                            build.py --version tag --demo merged,
                                            wrangler deploy

deploy.yml has two triggers: workflow_call, from the deploy job of release.yml, and workflow_dispatch. A push to main does not deploy.

It isn't on: release because release.yml creates the release with the workflow token, and GitHub starts no workflow from events that token causes. on: workflow_run would run the default branch's copy of the workflow instead of the tag's.

  • resolve:
    • Without CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID it warns, and the other jobs skip, before any capture.
    • Otherwise it takes the given tag, or the newest release with a SHA256SUMS asset (the same choice e2e-report.yml makes, because the "latest release" endpoint leaves out prereleases).
    • A tag without site/index.html predates the website build and is refused.
  • demo: calls report.yml with the four pages and the tag as version, the same path consumers use. It needs pull-requests: write only because report.yml declares it; outside a pull request it posts no comment.
  • site:
    • It runs even if the demo job broke. A missing omnisnap-merged artifact counts as a demo that compared nothing.
    • It checks out the tag and builds with GITHUB_TOKEN for the docs.
    • wrangler.json uploads _site/ as the Worker's assets.
    • The deploy-site concurrency group runs one deploy at a time and never cancels one in progress.

The demo pages are the owner's own sites only: corrosion-vst.org/, /wiki/, synaptech-solutions.com/ and /es. corrosion-vst.org/play/ was tried and left out: only Chrome captured it.

src/worker.js is unchanged by the website:

  • it redirects www.omnisnap.org to the apex;
  • it adds Access-Control-Allow-Origin: * and nosniff under /schema/;
  • it passes everything else to the assets.

Cloudflare's default html_handling serves /docs/quickstart/ from docs/quickstart/index.html and redirects /docs/quickstart to it. not_found_handling: "404-page" serves 404.html.

Tests

tools/site/test_build.py needs no network: a fake renderer returns the saved response. Run it with python3 -m unittest discover tools/site. It covers:

  • version spellings;
  • each kind of link, links inside code, links to missing files;
  • that every # link in the saved guide has a target;
  • the docs pages and index, and the nav on every page;
  • the shared shell on every page (header, logo, theme switch, the head script before the stylesheet, site.js, the footer's release);
  • that no page other than the demo loads anything from another origin;
  • that every asset is copied, and that a missing one fails the build;
  • "On this page" from the saved response, nested h3s, markup dropped from the text, and the build failing for a heading with no id or a guide with no h2;
  • that each guide links the other two and marks itself, and that its code and tables take keyboard focus;
  • the docs index cards;
  • the landing page's versions, its install commands with no panel hidden (JavaScript off), the hero figure and the screenshot's link to /demo/;
  • every schema at its $id path and in the list, and each card's first sentence of description;
  • the 404 page and its links to Home, Docs and Demo;
  • demo trimming, a ../ screenshot path, and the "compared nothing" cases, including that nothing is written then.

Source files

Clone this wiki locally