[ DOCS ] /docs
Documentation
This site is a portfolio you can script. Its look, its content and its commands are controlled by programs written in Eitri, a small language I wrote, and a second tool uses the same language to draw GitHub profile cards. These pages explain both.
Three ways in#
⌘K / Ctrl K
Command palette
Search every action on the page: built-in ones such as Open console and Go to Work, and any a script has registered.
Console guide →`
Console
An editor for Eitri scripts. A script can change the look of the page, reorder the work, react to events and add its own commands.
Console guide →/card
Card studio
Design a GitHub profile card in Eitri, preview it live and embed it in a README as an SVG.
Card guide →The palette and the console are on every page. The console opens with the backtick key, from Open console in the palette, or from the Console button in the top bar. The card studio is a page of its own at /card.
A first script#
Open the console, replace the text with this, and press Run (or ⌘/Ctrl + Enter). The accent colour turns magenta, rain starts, the hero gets a new title and the console prints one line. Reset puts everything back.
import site from "site"
import theme from "site/theme"
theme.hue(320)
theme.weather(.Rain)
site.title("hello, console")
site.print("projects: ${site.projects.len()}")
The language is covered in the Eitri tour, and every function a script can call is in the SDK reference.
Saving and sharing#
- Saved scripts. A script that runs cleanly with Run is saved in this browser (local storage). On later visits it runs again right after the page loads, silently: no toasts, sounds, effects, prompts or navigation, but the look, the content and every action, handler, key binding and timer it registers are back.
- Share links. Share in the console copies a link ending in
#eitri=…. Opening it runs that script. It is not saved unless you press Run. - Reset. Reset in the console, or Reset the page in the palette, clears the saved script and returns the page to its defaults.
- Cards. The studio remembers its script and username in the browser too. A card can be shared as a short link, which stores the script on the server, or as a long link that carries the whole script.
Details are in the console guide and the card guide.
Privacy#
Eitri runs in your browser, compiled to WebAssembly. Console scripts, your saved script, your visit count and your preferences stay in this browser's local storage; nothing about them is sent to a server.
Keyboard shortcuts#
⌘ is Ctrl on Windows and Linux.
| Keys | Where | What it does |
|---|---|---|
| ` | Anywhere except a text field | Open or close the console. |
| ⌘ K | Anywhere, even in a field | Open or close the command palette. |
| Esc | Console, palette, key mode | Close the palette or the console (when focus is in it); leave a key mode started by a script. |
| ⌘ Enter | Console editor | Run the script and save it if it ran cleanly. |
| Tab | Console editor | Insert four spaces. |
| Ctrl M | Console editor | Make Tab move focus instead of inserting spaces; press again to undo. |
| ← → | Console resize handle | Widen or narrow the docked console by 20 px (80 px with Shift). |
| ↑ ↓ | Palette | Move through the list (also Ctrl N and Ctrl P); Page Up and Page Down jump by eight. |
| Enter | Palette | Run the highlighted action, or answer the prompt. |
| ↑ ↑ ↓ ↓ ← → ← → B A | Page | Does nothing by itself; scripts can react to it with the konami event. |
Scripts can add their own keys with site/keys. The default script binds Shift H to a greeting.
Where next#
- Console: the panel, the editor and what a run does.
- Eitri language: a short tour for JavaScript and TypeScript developers.
- SDK reference: every function, generated from the declaration files.
- Card studio and HTTP API.