8000 GitHub - bangerpage/banger: Presentations that move, written as one HTML file. · GitHub
[go: up one dir, main page]

Skip to content
bangerpagePublic

About

Presentations that move, written as one HTML file.

Topics

Resources

Stars

8 stars

Watchers

0 watching

Forks

Repository files navigation

Banger

Presentations that move, written as one HTML file.

English | 日本語

A Banger deck seen from above: six frames laid out on a canvas

Banger puts your frames on a canvas and moves a camera between them. Zoom into a number, glide to the next idea, then pull back and show the whole picture. There are no slides to flip and no build step: a deck is one HTML file that opens in any browser, lives happily in git, and is small enough for an AI to write from start to finish.

Why Banger

  • One file, one line. Load the runtime with a single <script> tag and write the deck with bang-* elements. No bundler, no framework, no editor to install.
  • A canvas, not a stack. Frames sit on a grid. Stops decide where the camera rests: a whole frame, a region of it, one element in it, or the overview of everything.
  • Good-looking by default. Sizes, tones and gaps are tokens, not free-form CSS, so a deck stays on the design system whoever writes it. Pick a bundled theme or bring your own colours and fonts; unreadable colour pairs are flagged.
  • Made for writing with AI. The vocabulary is small and documented in skill/, so an agent can write a deck, render every stop with banger snap, look at the images and fix what overflows.
  • Ready for the stage. Step-by-step reveals for lists and chart series, speaker notes in a presenter window, full screen, and a PDF export with real, selectable text.

A single frame with three cards: pick, don't style; look, then fix; hand it over

Try it

Save this as index.html and open it in a browser. Press the right arrow to move, o to see the whole canvas.

<!doctype html>
<meta charset="utf-8">
<title>My talk</title>
<script type="module" src="https://cdn.jsdelivr.net/npm/@bangerpage/core@0.5.0-rc.2/dist/index.js"></script>
<bang-root theme="light">
  <bang-frame id="hello" at="0,0">
    <bang-title>Hello</bang-title>
    <bang-list step="1">
      <li>Frames sit on a canvas</li>
      <li>The camera stops where you tell it to</li>
    </bang-list>
  </bang-frame>
  <bang-frame id="more" at="1,0" tone="accent">
    <bang-title size="2xl">Next idea</bang-title>
  </bang-frame>
  <bang-path>
    <bang-stop frame="hello" steps="2"><bang-notes>Say hello</bang-notes></bang-stop>
    <bang-stop frame="more"></bang-stop>
    <bang-stop overview></bang-stop>
  </bang-path>
</bang-root>

Or let the CLI write a starter for you with npx @bangerpage/cli init my-talk.

Then, from the deck's directory, use the CLI (it needs Node 22 or later and Chrome):

npx @bangerpage/cli preview       # live reload while you edit
npx @bangerpage/cli snap          # every stop as a 1920x1080 PNG
npx @bangerpage/cli export --pdf  # one PDF page per stop

For a fuller deck, open examples/showcase/index.html (the one in the pictures above).

Presenting

Key Action
Right arrow, Space, Page Down, Enter Next step or stop
Left arrow, Backspace, Page Up Previous step or stop
Home / End First / last stop
o or Esc Overview of the whole canvas
Click a frame in the overview Go to that frame
p Presenter window with speaker notes, kept in sync with the audience window
f Full screen
l Next language, in a deck with languages
? Keyboard shortcuts
Swipe left / right Next / previous, on a touch screen
Tap the left / right quarter of the screen Previous / next, on a touch screen; links, buttons and charts keep their own tap, and a deck embedded in another page leaves the tap to that page
Quick long mouse flick up or left / down or right Next / previous, for page-turner remotes that drag the mouse

After the first flick from such a remote, the deck stops selecting text and hides the mouse cursor until you move the mouse by hand.

The current position is kept in the URL (#stop=N&step=M), so a reload or a shared link lands on the same place.

Multilingual decks

One deck can carry several languages. List them on bang-root (the first is the author's language) and put each language's text next to the other as siblings, using the HTML lang attribute. The frames, stops, steps and theme are shared.

<bang-root languages="ja en">
  <bang-frame id="hello" at="0,0" crumb="なぜ" crumb-en="Why">
    <bang-title>
      <span lang="ja">めくらない発表</span>
      <span lang="en">Presentations that move</span>
    </bang-title>
    <bang-list step="1">
      <li lang="ja">フレームはキャンバスに並ぶ</li>
      <li lang="en">Frames sit on a canvas</li>
    </bang-list>
  </bang-frame>
  ...
</bang-root>

An element with a lang is shown only while that language is selected; elements without lang are shown in every language. The language comes from ?lang=en in the URL, then the browser's language settings, then the first language in languages. Press l while presenting to switch to the next language; the presenter window and the audience window switch together, and ?lang= follows. Pin the runtime to @bangerpage/core@0.2.0 or later for such a deck.

banger check renders every language and reports translation mistakes, such as a missing <li> in one language. banger snap and banger export --pdf take --lang <language>|all.

Frames inside frames (beta)

A bang-frame written directly inside another bang-frame becomes a child placed in the parent's cells. Show the whole picture on the parent, zoom into each child in turn, then come back to the parent for the conclusion: the audience keeps seeing where each part belongs.

A parent frame with its heading at the top and three child frames, each named by a large label

<bang-frame id="moves" at="1,0" span="3,2">
  <bang-title size="2xl">Three moves, one build</bang-title>
  <bang-frame id="measure" at="0,1" label="Measure">...</bang-frame>
  <bang-frame id="cache" at="1,1" label="Cache">...</bang-frame>
  <bang-frame id="split" at="2,1" label="Split">...</bang-frame>
</bang-frame>
<bang-path>
  <bang-stop frame="moves" steps="0"></bang-stop>
  <bang-stop frame="measure"></bang-stop>
  <bang-stop frame="cache"></bang-stop>
  <bang-stop frame="split"></bang-stop>
  <bang-stop frame="moves" steps="1"></bang-stop>
</bang-path>

A child's at and span count the parent's cells, and the parent packs its own content at the top. label names a child while the camera is on its parent. banger check warns when a child is outside its parent or covers the parent's own content. examples/nested/index.html is a full deck in English and Japanese; it is also published at banger.page/banger/nested. Pin the runtime to @bangerpage/core@0.3.0 or later for such a deck.

Nested frames and label are beta: they are checked and supported, but how a parent lays out its own content may still change in a minor release. format="map" is experimental, which means its look and attributes may change in any release.

Writing decks with AI

skill/ is an agent skill: SKILL.md describes the workflow and the rules, reference/ lists every element, attribute and pattern, and templates/starter.html is the starting point. The skill text is in Japanese; the element reference is in English.

In Claude Code, install it as a plugin. The plugin updates when a new version is released:

/plugin marketplace add bangerpage/banger
/plugin install banger@bangerpage

The skill also needs the CLI, which previews, checks and exports the deck: npm install -g @bangerpage/cli.

The CLI carries the skill that matches its version, and can write it out instead of the plugin:

banger skill install             # writes ~/.claude/skills/banger
banger skill install --project   # or ./.claude/skills/banger for this project only
banger skill pack                # writes banger-skill.zip

Running banger skill install again after updating the CLI replaces the copy; a directory that banger did not write is left alone unless you pass --force. For another agent, --dir <path> writes the skill wherever that agent reads skills from. banger skill pack writes a zip for the Claude app (claude.ai or Claude Desktop): upload it from the app's Skills settings. In the app the agent writes the HTML, but it may not be able to run the CLI.

With the skill, the agent agrees on the outline as a list of stops, writes index.html, runs banger check and banger snap to look at every stop, and fixes what the CLI warns about (overflow, unknown tags, unreadable colours, failed components).

Elements

Element Purpose
bang-root The deck. Picks the theme.
bang-frame A 1920x1080 area on the canvas, placed with at="col,row". Written directly inside another bang-frame, it becomes a child placed in the parent's cells.
bang-path, bang-stop The order of camera stops: a frame, a region of it, one element (focus), or the overview.
bang-title, bang-text, bang-list Headings, paragraphs and lists, revealed step by step if you like.
bang-columns, bang-stack, bang-card Layout.
bang-stat, bang-chart, bang-image, bang-shape Big numbers, charts, images, arrows and marks.
bang-code Code in the theme's colors, with the lines to look at moving step by step.
bang-free Free HTML, CSS and SVG for the figure no element can draw.
bang-pen A hand-drawn circle, underline or arrow laid over an element, placed by its id.
bang-notes Speaker notes for a stop.
bang-theme A custom theme as JSON.

Every attribute and its values are in skill/reference/components.md.

Packages

  • packages/core (@bangerpage/core): the runtime (custom elements, camera, state) and its theme.
  • packages/cli (@bangerpage/cli): the banger command (preview, PNG snapshots, PDF export, themes) and a library entry for PDF export.
  • skill/: the AI skill (SKILL.md, component reference, patterns, starter template).
  • examples/showcase: the deck in the pictures above.
  • examples/minimal: a small deck that shows the main components.
  • examples/nested: a deck in English and Japanese that zooms from a whole picture into its parts with nested frames.

bang-root format="map" lays the frames out as an experimental map (ground, roads between linked frames, fog over the parts not yet reached). Its look and attributes may change in any release.

Reference

Versions and network access

  • Pin the exact runtime version in the URL (@bangerpage/core@0.1.0), not a range such as @0 or @0.1. The runtime loads its chunks by relative path, so a range that moves to a new version can break a page that has the old entry cached. While the version is 0.x, a minor release may rename elements, attributes or theme keys; a pinned deck keeps working on the version it names. The running version is customElements.get("bang-root").version.
  • dist/standalone.js is the same runtime in one file (about 1.6 MB) with the lazy parts, such as the chart library, inlined. Use it where the runtime cannot load its other files by relative path: a deck that inlines the runtime into its own HTML, or a copy of the runtime saved next to a deck that is opened offline. Otherwise use dist/index.js, which loads less up front. Write dist/index.js in a deck published to banger.page.
  • The CLI renders every deck with the core it bundles and prints a warning when the deck pins another version. Check a deck with the CLI version that matches its pin.
  • Opening a deck loads the runtime from the CDN and the fonts from Google Fonts (fonts.googleapis.com and fonts.gstatic.com), so it needs network access, and each viewer's browser contacts those hosts. A custom theme can change the font families (fontsHref), but the default families are still requested.

Custom theme

Set theme="custom" on bang-root and put a bang-theme child with a JSON script. Keys you leave out take the values of base (light or dark).

<bang-root theme="custom">
  <bang-theme>
    <script type="application/json">
      { "base": "dark", "paper": "#0F1B2D", "ink": "#F2F5FA", "signal": "#FFB000" }
    </script>
  </bang-theme>
  ...
</bang-root>

Besides colours and fonts, a theme can set typography (weights, leading, tracking), gradients for the ground, covers and bands, card shadows and corners (cardShadow, cardRadius) and the text colour on accent frames (onSignal). Every key is described in skill/reference/themes.md.

To reuse one look across decks, keep a theme.json and run banger theme init once, then banger theme apply theme.json deck.html for each deck. Colors are checked for contrast when the deck is rendered, and banger snap prints a warning: line for unreadable combinations.

CLI

  • banger init [dir] [--force]: start a deck by writing index.html from the starter template into dir (default: the working directory).
  • banger import <source.html> <dir> [--min-bytes N] [--force]: the first step of converting an HTML slide deck made elsewhere. It pulls every embedded image, font and media file (data: URI) of at least 2 KB (change with --min-bytes) out of the source into dir/images/, dir/fonts/ and dir/media/ (anything else goes to dir/assets/), one file per distinct content, and writes dir/source.stripped.html, a copy of the source that points at those files and is small enough for an agent to read. The source is not changed, and existing files are not overwritten without --force. The conversion itself follows skill/reference/bangerize.md.
  • banger preview [file] [--port N] [--allow-host <name>]: preview with live reload. Without [file], preview, snap and export use index.html in the working directory. The runtime URL in the HTML is served from the bundled core, so it works offline and before publishing. In the presenter window (p), the top shows the logged-in banger.page account and, when you preview index.html, the deck's visibility, version and URL there. Only the preview server uses the token to look this up; it never reaches the browser, and nothing is shown offline. The server listens on 127.0.0.1 and answers only requests addressed to 127.0.0.1 or localhost, so another website cannot read the deck folder through DNS rebinding; to view it through a proxy such as tailscale serve, add that host name with --allow-host (the account is still shown only on this machine). Dotfiles and node_modules are not served, as banger publish does not send them.
  • banger snap [file] [--stop N] [--step M|last] [--steps last|all] [--out path] [--out-dir dir] [--scale 1|2] [--lang <language>|all] [--sheet] [--diff <baseline>] [--json]: render states as 1920x1080 PNG files. Without --stop every stop is written at its last step; --steps all also writes every step on the way. In a deck with languages, --lang <language> renders that language and --lang all writes snap/<language>/ for each one; without it the first language is used (--lang all cannot be combined with --out). The PNG files are not guaranteed to be byte-identical between runs: anti-aliasing of text can differ by a pixel, so compare them with a tolerance (--diff does this for you, see below). --sheet writes no stop PNGs: it shrinks every stop (every step with --steps all) onto sheet-01.png, sheet-02.png, ... in the out dir (4 columns, 20 cells per page, each cell labelled like #7 intro step 2/3 ja; with --lang all, in <out-dir>/<language>/), so the whole deck can be reviewed in a few images. A cell with a failed component gets a red frame and failed, and the command exits 1. The cells are small: text and coordinates cannot be read from a sheet, so use snap --stop N for them. --sheet cannot be combined with --stop, --step, --out or --scale. --diff <baseline> renders the deck again and lists the stops that look different from a baseline: another HTML file, a folder of an earlier snap, or git:<rev> (git:HEAD, git:main~3: the committed version of the deck). Stops are matched by frame id and the order within that frame, so inserting a stop does not shift the rest (a snap folder carries no frame ids and is matched by stop number, which the output says). It prints changed: / added: / removed: lines with the box that changed and a summary such as 2 changed, 1 added, 0 removed, 37 unchanged, and writes the changed stops, before | after | the changed area, to diff-01.png, ... in the out dir (none when nothing changed). --json prints { items, summary, matchedBy, failed, images, baselineFailed, baselineMissingLanguages }. A difference does not change the exit code; a failed component in the current deck, a language the baseline lacks, or a snap folder whose images are not 1920x1080 exits 1. Only a channel difference above 8 counts against an HTML file or git (above 48 against a snap folder, which may come from another machine), and a change under 6 connected pixels is ignored, so a colour change such as #777 to #555 is invisible against a snap folder. --diff cannot be combined with --sheet, --stop, --step, --out or --scale; --json needs --diff.
  • banger time [file] [--slot <minutes>] [--json]: estimate how long the talk runs, per language, from the number of stops and steps and the amount of speaker notes (bang-notes), and compare it with a slot. The estimate is a rule of thumb, not a measurement: Japanese is read at 320 characters a minute, Chinese at 270, Korean at 300 and other languages at 140 words a minute (URLs are not counted), with a floor of 5 seconds per stop and 2 seconds per step, and a range of 15% either way. It prints the stops and steps, the amount of notes, the minutes and the range, how many stops have no notes (counted at the floor only) and the 5 longest stops (candidates to cut); --slot 30 adds how far over or under 30 minutes it is. A deck without languages is read at the speed of its <html lang>. It takes pictures of nothing and always exits 0 (2 for a usage error); --json prints the same as { slotMinutes?, languages }. Notes that are not a script (bullet fragments) make the estimate too short, and a language without notes of its own shows another language's notes, which are counted.
  • banger check [file] [--json]: render every stop without taking pictures and list the problems the runtime finds: content that does not fit inside its frame or runs out of a card, bang-* tags that do not exist, frames on the same cell, stops naming a missing frame, invalid attribute values, unreadable colours and failed components. In a deck with languages it renders every language, prefixes each line with the language ([en] ) and also reports translation mistakes. It also warns when a heading reads under 24px on a 1920x1080 screen at a stop (for example a parent frame with a large span). It exits 1 when there is any problem; --json prints { ok, stops, warnings, failed, notes } and, when there is something to report, diagnostics: info about small body text, too many child frames and empty cells, each with candidate fixes (only raise-size carries edits that can be applied mechanically). Web fonts that did not load (for example on a network that blocks Google Fonts) are printed as note: lines and do not count as problems; the layout is then checked with fallback fonts.
  • banger export [file] --pdf [--out path] [--steps last|all] [--lang <language>|all]: one PDF page per stop, with vector text. In a deck with languages, --lang <language> writes deck.<language>.pdf and --lang all writes one PDF per language; without it the first language is written to deck.pdf. --lang all and --out cannot be used together.
  • snap, check and export open the deck in a headless Chrome or Chromium with its sandbox on, since the deck's scripts run there. Where the sandbox cannot start (as root in a container, for example) they stop with an error; set BANGER_NO_SANDBOX=1 to run without it, only for decks you trust.
  • banger theme init [file] [--from <preset>] [--force]: write a theme.json from a bundled preset (signal, signal-dark, sunshine, midnight).
  • banger theme apply <theme.json> <deck.html>: embed the theme in a deck and set theme="custom". Running it again gives the same result.
  • banger skill install [--project | --dir <path>] [--force]: copy the agent skill bundled with this CLI version to ~/.claude/skills/banger (or ./.claude/skills/banger, or <path>).
  • banger skill pack [--out <file>]: write the bundled skill as a zip (default banger-skill.zip) with one top-level banger/ folder, the layout the Claude app accepts for upload.
  • banger login [--profile <name>] [--token <token>]: log in to banger.page. It opens the browser, where you log in and allow the CLI, and keeps the token in ~/.config/banger/credentials.json (readable only by you). Without a browser, pass a token made on the site's settings page with --token. --profile <name> saves the login under a name, so several accounts (yours and an organisation's, say) can be kept at once; without it the login is the default profile. Logging in again to a saved profile as a different account is refused until you run banger logout --profile <name>. banger logout [--profile <name>] forgets that profile only; it revokes the token on the site unless it was added with --token or another saved login holds the same token. In CI, set BANGER_TOKEN instead. Choose a profile with --profile or BANGER_PROFILE (--profile wins); BANGER_PROFILE and BANGER_TOKEN cannot be set together, and a profile that is not saved is an error, never a fall back to default. Once you use profiles, run banger 0.5.0 or later everywhere: an older banger login or banger logout overwrites the whole entry and deletes every named profile.
  • banger whoami [--profile <name>]: ask banger.page which account the next publish would use, and print the site, where the token comes from (profile <name> or BANGER_TOKEN) and @username. It says so when the token is no longer accepted. banger profiles lists the saved logins (site, name, account) without asking the site, and never prints a token.
  • banger publish [dir] [--slug <slug>] [--title <title>] [--visibility public|unlisted] [--strict] [--skip-check] [--dry-run] [--profile <name>] [--update]: run banger check on the deck in dir (default: the working directory), then send index.html and the files next to it that banger.page accepts (images, fonts, video, JSON, CSS, JS and deck.pdf; dotfiles and node_modules are left out) and publish it. The slug defaults to the directory name. The slug and URL are kept in .banger/deck.json, so the next run updates the same deck. The first line says which account it publishes to (publishing to <site> as @<username> (profile <name>), also with --dry-run). A slug belongs to an account, so the same directory published to another account is a separate deck there, and each later run updates the deck of the account it is run as; the record is kept per account in .banger/deck.json. When this directory has no record of the account (a new clone, or a 0.4.x directory you published to two accounts in turn), --update [--slug <slug>] updates the deck with that slug among the account's own decks and records it; it never creates one. Check warnings do not stop a publish unless you pass --strict; failed components always do. banger.page shows the deck in a sandboxed iframe, so a deck can load only its own files (and Google Fonts), cannot embed iframes or submit forms, and must not open windows or navigate by itself; the full list is in skill/reference/publishing.md.
  • banger feedback new / banger feedback send <file> [--via gh|web|inbox] [--yes] [--dry-run]: send what you learned from a finished deck to Banger. new writes a draft (feedback.md) in a temporary directory, outside the working tree, and prints its path. send stops when the draft holds a token or key, an absolute path, an email address, this computer's account name or a control character that could hide text (it prints line numbers and kinds, never the values), then shows the final text and where it goes, and sends it only after you confirm. --via gh opens a public GitHub issue on bangerpage/banger from your own gh login, --via web opens the new-issue page with the text filled in for you to submit, and --via inbox sends it anonymously to the banger.page feedback inbox (only the Banger maintainers read it; the inbox sees your IP address). --yes skips only the [y/N] question, so use it only after a person has read the text; --dry-run sends nothing.

In a terminal, the CLI checks npm for a newer @bangerpage/cli at most once a day and prints a notice on the next run; the check never delays a command. Set BANGER_NO_UPDATE_CHECK=1 to turn it off (it is also off when CI is set or stderr is not a terminal).

When a skill that banger skill install wrote (in ~/.claude/skills/banger, or .claude/skills/banger in the working directory) is older than the CLI, a command run in a terminal asks whether to update it (Enter updates; after a no, it asks again only once the CLI is updated). Where no one can answer, such as in an AI agent's shell, it prints one line with the command that updates it. A skill folder banger did not write is left alone. BANGER_NO_UPDATE_CHECK=1 and CI turn this off too.

The CLI drives Chrome through playwright-core. If no browser is found it prints the command to install one and exits with code 2.

As a library

import { exportPdf } from "@bangerpage/cli";

const path = await exportPdf("deck.html", { steps: "last" });

exportPdf resolves with the absolute path of the written PDF. Failures throw a CliError whose exitCode is the code the command would exit with (1 for a deck that fails to render, 2 for bad input). Pass onWarning to receive warnings such as a runtime version mismatch instead of having them written to stderr.

Development

pnpm install
pnpm gen         # regenerate the theme, custom-elements.json and the skill files
pnpm typecheck
pnpm build
pnpm test
pnpm -C packages/core exec playwright-core install chromium   # once, for the e2e tests
pnpm test:e2e

The CLI and the examples load packages/*/dist, so run pnpm build after pulling before trying them from this checkout.

Generated files (skill/reference/components.md, the runtime URL in the starter, the example and the CLI fixtures) are committed. After changing a component's attributes or JSDoc, run pnpm gen and commit the result; CI runs pnpm gen:check.

Release

Pushing a v<version> tag publishes both packages from CI (.github/workflows/release.yml).

  1. Add a ## <version> section to CHANGELOG.md; it becomes the GitHub release notes (a prerelease such as 0.2.0-rc.1 uses the ## 0.2.0 section). Set the same version in packages/core/package.json and packages/cli/package.json, run pnpm gen (it updates the runtime URL in the starter, the examples, the READMEs and the fixtures) and commit.
  2. Push the commit and wait for ci to pass.
  3. Tag the commit v<version> and push the tag. The release workflow checks that the tag matches both versions, runs every check again, publishes core before cli with npm trusted publishing (no npm token in the repository) and creates the GitHub release.

A version with a prerelease part (0.2.0-rc.1) is published under the npm dist-tag next and marked as a prerelease on GitHub, so npm install @bangerpage/cli keeps installing the last release. Try it with npx @bangerpage/cli@next or by pinning @bangerpage/core@0.2.0-rc.1 in a deck.

Trusted publishing is set up once per package on npmjs.com: in the package's settings, add a trusted publisher for the GitHub repository bangerpage/banger and the workflow release.yml.

Sponsors

Banger is developed and maintained independently. If it helps you, please consider supporting its development via GitHub Sponsors.

Sponsor

License

MIT. The name "Banger" and the Banger logos (such as examples/minimal/assets/banger-mark.svg) are not covered by the license: you may not use them to suggest that your project is Banger or is endorsed by it.

About

Presentations that move, written as one HTML file.

Topics

Resources

Stars

8 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages

0