Repository navigation
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.
| 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
|
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.
-
Versions.
versionsturns the tag into its three spellings:v0.1.0-rc.7for the binary and the Action,0.1.0-rc.7for npm, and0.1.0rc7for PyPI (PEP 440). A string that isn't a release tag is an error. -
The demo check, first. With
--demo,compared_anythingmust find asummary.jsonwith at least one result whose status is notfailedorunreachable. Otherwise the build stops before writing anything: "the demo compared nothing". -
A clean output.
_site/is deleted and recreated, so nothing from an earlier build is uploaded. -
Landing page.
build_landingsubstitutes{{version}},{{npm_version}}and{{pypi_version}}insite/index.html; an unknown placeholder is an error. It wraps the result in the shared page template.copy_assetsthen copies every path inASSETS(the stylesheet, the script, the tab icons, the fonts and their licence, the report screenshot) fromsite/; a missing one is aBuildError("site/ is missing …"). -
Schemas and 404.
build_schemascopies eachschema/*.schema.jsonto the path afteromnisnap.org/in its$id, as the previous schema-only site did, and writes the list at/schema/: a card per schema with itstitle, its URL andfirst_sentence(description)(the text up to the first ". " outside parentheses).build_404writes the not-found page. -
Docs.
build_docsrenders each guide inGUIDES(described in the next section). -
Demo.
build_democopies the merged bundle'sreport.htmlto/demo/index.html, plus only the screenshots itssummary.jsonnames (results[].shots.baseline.srcand.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).
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:
-
articlekeeps the<article class="markdown-body">and drops GitHub's file wrapper. -
rewrite_linksrewrites 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/, ortree/for a directory); - absolute URLs and
#fragmentsare 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 ahref="…"written inside a code block is never touched: GitHub escapes or splits it there. - a link to another guide becomes its
-
fix_anchorsstrips GitHub'suser-content-prefix fromidandname. github.com maps#xtouser-content-xwith JavaScript, and the site must work without it, so the ids carry the plain slug and#xlinks work. -
focusableaddstabindex="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'sscrollable-region-focusable). GitHub does this with script. The landing page's own<pre>s carry the attribute insite/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.
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;#4199F0in the dark theme) and--diff, the amber for what differs (#a14a08light,#f5a524dark). Every text colour passes WCAG AA on every background it is used on;#a14a08was 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.
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-themeon<html>and stores the choice asomnisnap-theme.THEME_SCRIPTin<head>applies a stored choice before the first paint, so pages don't flash. -
Copy buttons on every
pre, only wherenavigator.clipboardexists in a secure context. The copied text drops leading$prompts. -
The install tabs: a
[data-tabs]box of.tab-panelsections, each headed by anh3, becomes a WAI-ARIA tablist (arrow keys, Home, End). The choice is stored asomnisnap-tab-<id>. Without the script the panels are three headed sections, all visible. -
The current section in "On this page": an
IntersectionObserversetsaria-currenton 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.
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.htmldraws "article.cardwraps differently" on corrosion-vst.org, Chrome against WebKitGTK on Linux, from theomnisnap-mergedartifact of release run 46175620749 (v0.2.0-rc.4). The numbers come fromlinux-amd64/corrosion-vst.org/findings.json: thewrapcause whoseselectorismain > section.tour:nth-of-type(2) > div.cards > article.card:nth-of-type(1) > p:nth-of-type(2). Itsboxesgive 206×162.8 px in Chrome and 206×138 px in WebKitGTK, anddeltagivesdh−24.8 anddln−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.webpis the viewer on that result (#r4in that bundle). It was taken from a copy of the bundle'sreport.htmlwith a<style>that hides#summary,#host-selector,.host-header,.page-header,.page-url, every other result, the causes after the first, the info causes,.intentand.audit. Headless Chrome took it at 1280×800 CSS px with--force-device-scale-factor=2and light theme, andcwebp -q 75 -m 6converted it (123 KB). A fragment in the URL doesn't scroll in--screenshot, which is why the copy hides the rest instead.
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_TOKENandCLOUDFLARE_ACCOUNT_IDit warns, and the other jobs skip, before any capture. - Otherwise it takes the given tag, or the newest release with a
SHA256SUMSasset (the same choicee2e-report.ymlmakes, because the "latest release" endpoint leaves out prereleases). - A tag without
site/index.htmlpredates the website build and is refused.
- Without
-
demo: callsreport.ymlwith the four pages and the tag asversion, the same path consumers use. It needspull-requests: writeonly becausereport.ymldeclares it; outside a pull request it posts no comment. -
site:- It runs even if the demo job broke. A missing
omnisnap-mergedartifact counts as a demo that compared nothing. - It checks out the tag and builds with
GITHUB_TOKENfor the docs. -
wrangler.jsonuploads_site/as the Worker's assets. - The
deploy-siteconcurrency group runs one deploy at a time and never cancels one in progress.
- It runs even if the demo job broke. A missing
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.orgto the apex; - it adds
Access-Control-Allow-Origin: *andnosniffunder/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.
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 noh2; - 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
$idpath and in the list, and each card's first sentence ofdescription; - 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.
-
tools/site/build.py: builds the site -
tools/site/test_build.py: its tests -
tools/site/testdata: a saved GitHub rendering of a guide -
site/index.html: the landing page -
site/site.css: the stylesheet -
site/site.js: the script: theme switch, copy buttons, install tabs, current section -
site/fonts: IBM Plex Sans and Mono, Latin-1 WOFF2 subsets from@ibm/plex-sans2.0.0 and@ibm/plex-mono2.5.0, andOFL.txt -
site/img/report.webp: the report screenshot on the landing page -
site/favicon.svg: the tab icon,docs/logo.svgcropped to the mark with strokes thick enough for 16 px -
site/favicon.ico: the same icon at 16, 32 and 48 px, for pages without an icon link -
.github/workflows/deploy.yml: the deploy -
.github/workflows/release.yml: calls the deploy after a release -
wrangler.json: the Worker, its assets and its domains -
src/worker.js: the Worker's code
This wiki is published from docs/internals/ on main. Edits made here are overwritten on the next publish: change the pages there, in a pull request. The specs are normative; where a page and a spec disagree, the page says what the code does.
Start
Contracts
Capture side
Analysis side
Output
Quality