commit
feat: Improved Markdown
This intergrates Markdown like GitHub does with the > [!NOTE] notation=
diff --git a/src/icons.ts b/src/icons.ts
new file mode 100644
index 0000000..7e1de41
--- /dev/null
+++ b/src/icons.ts
@@ -0,0 +1,44 @@
+/* src/icons.ts */
+//
+// Inline pixel icons, read straight from the installed `pixelarticons` package
+// (MIT, © 2019 Gerrit Halfmann). No icon paths are copied into this repo, so
+// the set always matches the installed version. esbuild keeps the package
+// external (see scripts/build.mjs) and it ships as a runtime dependency, so
+// getIconSvg resolves its svg/ files in dev and in the Docker image alike.
+
+import { getIconSvg } from "pixelarticons";
+
+// Parsed icon source, cached per name so each file is read once per process.
+const cache = new Map<string, { viewBox: string; body: string }>();
+
+function parse(name: string): { viewBox: string; body: string } {
+ const cached = cache.get(name);
+ if (cached !== undefined) return cached;
+
+ const source = getIconSvg(name);
+ if (source === null) {
+ throw new Error(`icon: unknown pixelarticons icon "${name}"`);
+ }
+
+ const viewBox = /viewBox="([^"]+)"/.exec(source)?.[1] ?? "0 0 24 24";
+ const body = source
+ .slice(source.indexOf(">") + 1, source.lastIndexOf("</svg>"))
+ .replace(/\s*\n\s*/g, "")
+ .replace(/>\s+</g, "><")
+ .trim();
+
+ const parsed = {
+ viewBox,
+ body,
+ };
+ cache.set(name, parsed);
+ return parsed;
+}
+
+// Render one icon as an inline SVG string. `name` is any pixelarticons name
+// (kebab-case, e.g. "git-branch", "folder", "lock"). Colour follows the
+// parent's `currentColor`; the `.icon` class is styled in app.css.ts.
+export function icon(name: string, size = 16): string {
+ const { viewBox, body } = parse(name);
+ return `<svg class="icon" viewBox="${viewBox}" width="${size}" height="${size}" aria-hidden="true">${body}</svg>`;
+}
diff --git a/src/markdown.ts b/src/markdown.ts
index d3d6d41..3102749 100644
--- a/src/markdown.ts
+++ b/src/markdown.ts
@@ -1,18 +1,4 @@
/* src/markdown.ts */
-//
-// A small, deliberately safe Markdown renderer for repository READMEs.
-//
-// Why hand-rolled rather than a library: README content is attacker-controlled
-// — anyone who can push, on a repo that may be public — so this renderer is
-// escape-first. Every character is HTML-escaped before any markup is produced,
-// raw HTML from the source is never passed through, and link/image URLs go
-// through a scheme allowlist. Injection is impossible by construction instead
-// of depending on a sanitiser staying in step with a parser.
-//
-// Covers the README subset: ATX/setext headings, fenced and indented code,
-// blockquotes, nested and task lists, GFM tables, rules, images, links,
-// autolinks, emphasis, inline code, hard line breaks. Raw HTML blocks are
-// dropped rather than shown as escaped source.
export function escapeHtml(s: string): string {
return s
@@ -126,6 +112,28 @@ const FENCE = /^\s{0,3}(`{3,}|~{3,})\s*(\S*).*$/;
const RULE = /^\s{0,3}([-*_])[ \t]*(?:\1[ \t]*){2,}$/;
const QUOTE = /^\s{0,3}>/;
+// GitHub alert marker: the whole first line of a blockquote, nothing else.
+const ALERT = /^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*$/i;
+
+// Inline octicon SVGs, keyed by alert kind. Self-contained: no icon pack,
+// no external request, in keeping with this renderer's escape-first design.
+const ALERT_ICON: Record<string, string> = {
+ note: '<svg class="md-alert-icon" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg>',
+ tip: '<svg class="md-alert-icon" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M8 1.5c-2.363 0-4 1.69-4 3.75 0 .984.424 1.625.984 2.304l.214.253c.223.264.47.556.673.848.284.411.537.896.621 1.49a.75.75 0 0 1-1.484.211c-.04-.282-.163-.547-.37-.847a8.456 8.456 0 0 0-.542-.68c-.084-.1-.173-.205-.268-.32C3.201 7.75 2.5 6.766 2.5 5.25 2.5 2.31 4.863 0 8 0s5.5 2.31 5.5 5.25c0 1.516-.701 2.5-1.328 3.259-.095.115-.184.22-.268.319-.207.245-.383.453-.541.681-.208.3-.33.565-.37.847a.751.751 0 0 1-1.485-.212c.084-.593.337-1.078.621-1.489.203-.292.45-.584.673-.848.075-.088.147-.173.213-.253.561-.679.985-1.32.985-2.304 0-2.06-1.637-3.75-4-3.75ZM5.75 12h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM6 15.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75Z"></path></svg>',
+ important: '<svg class="md-alert-icon" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg>',
+ warning: '<svg class="md-alert-icon" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg>',
+ caution: '<svg class="md-alert-icon" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25A.749.749 0 0 1 11 16H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg>',
+};
+
+function alertBlock(kind: string, body: string[]): string {
+ const key = kind.toLowerCase();
+ const label = key.charAt(0).toUpperCase() + key.slice(1);
+ const icon = ALERT_ICON[key] ?? "";
+ const inner = blocks(body);
+ const title = `<p class="md-alert-title">${icon}${label}</p>`;
+ return `<div class="md-alert md-alert-${key}">\n${title}\n${inner}\n</div>`;
+}
+
function at(lines: string[], i: number): string {
return lines[i] ?? "";
}
@@ -328,6 +336,13 @@ function blocks(lines: string[]): string {
buf.push(at(lines, i).replace(/^\s{0,3}>\s?/, ""));
i++;
}
+
+ const marker = ALERT.exec(buf[0] ?? "");
+ if (marker) {
+ out.push(alertBlock(marker[1] ?? "", buf.slice(1)));
+ continue;
+ }
+
out.push(`<blockquote>\n${blocks(buf)}\n</blockquote>`);
continue;
}
diff --git a/src/styles/app.css-1.ts b/src/styles/app.css-1.ts
new file mode 100644
index 0000000..91145a0
--- /dev/null
+++ b/src/styles/app.css-1.ts
@@ -0,0 +1,474 @@
+/* src/styles/app.css.ts
+ *
+ * Component classes. Each is a generated, scoped class name (zero runtime).
+ * Imported as a single `classes` object by the HTML views.
+ */
+
+import { globalStyle, style } from "@vanilla-extract/css";
+import { vars } from "./theme.css";
+
+const readme = style({
+ margin: "1rem 0",
+ padding: "1rem 1.25rem",
+ background: vars.surface,
+ border: `1px solid ${vars.border}`,
+ borderRadius: vars.radius,
+ overflowWrap: "break-word",
+});
+
+export const classes = {
+ readme,
+
+ siteHeader: style({
+ display: "grid",
+ gridTemplateColumns: "1fr auto 1fr",
+ alignItems: "center",
+ gap: "1rem",
+ padding: "0.75rem 1.25rem",
+ borderBottom: `1px solid ${vars.border}`,
+ background: vars.bgRaised,
+ }),
+
+ siteTitle: style({
+ display: "flex",
+ alignItems: "center",
+ gap: "0.5rem",
+ fontWeight: 700,
+ fontSize: "1.1rem",
+ color: vars.text,
+ }),
+
+ siteLogo: style({
+ width: "1.5rem",
+ height: "1.5rem",
+ borderRadius: 0,
+ objectFit: "cover",
+ }),
+
+ siteWho: style({
+ display: "flex",
+ justifyContent: "center",
+ minWidth: 0,
+ }),
+
+ siteNav: style({
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "flex-end",
+ gap: "0.75rem",
+ }),
+
+ navLink: style({ color: vars.accent }),
+
+ user: style({
+ display: "flex",
+ alignItems: "center",
+ gap: "0.4rem",
+ minWidth: 0,
+ color: vars.textMuted,
+ whiteSpace: "nowrap",
+ overflow: "hidden",
+ textOverflow: "ellipsis",
+ }),
+
+ avatar: style({
+ position: "relative",
+ flexShrink: 0,
+ display: "inline-flex",
+ alignItems: "center",
+ justifyContent: "center",
+ borderRadius: 0,
+ background: vars.surfaceHi,
+ color: vars.textSoft,
+ fontWeight: 600,
+ lineHeight: 1,
+ overflow: "hidden",
+ userSelect: "none",
+ }),
+
+ avatarSm: style({
+ width: "25px",
+ minWidth: "25px",
+ maxWidth: "25px",
+ height: "25px",
+ minHeight: "25px",
+ maxHeight: "25px",
+ fontSize: "13px",
+ }),
+
+ avatarLg: style({
+ width: "60px",
+ minWidth: "60px",
+ maxWidth: "60px",
+ height: "60px",
+ minHeight: "60px",
+ maxHeight: "60px",
+ fontSize: "30px",
+ }),
+
+ avatarImg: style({
+ position: "absolute",
+ inset: 0,
+ width: "100%",
+ height: "100%",
+ objectFit: "cover",
+ }),
+
+ profileHead: style({
+ display: "flex",
+ alignItems: "center",
+ gap: "1rem",
+ margin: "0.5rem 0 1.5rem",
+ }),
+
+ profileName: style({
+ fontSize: "1.4rem",
+ margin: 0,
+ }),
+
+ ownerLink: style({ color: vars.textMuted }),
+
+ content: style({
+ maxWidth: "960px",
+ margin: "0 auto",
+ padding: "1.25rem",
+ }),
+
+ pageTitle: style({
+ fontSize: "1.4rem",
+ margin: "0.25rem 0 1rem",
+ }),
+
+ sectionTitle: style({
+ fontSize: "1.05rem",
+ margin: "1.5rem 0 0.5rem",
+ color: vars.textSoft,
+ }),
+
+ repoList: style({}),
+
+ repoRow: style({}),
+
+ repoName: style({ fontWeight: 600 }),
+
+ repoDesc: style({ color: vars.textMuted }),
+
+ repoVis: style({
+ fontFamily: vars.mono,
+ fontSize: "0.85em",
+ color: vars.textDim,
+ }),
+
+ repoIdle: style({
+ fontFamily: vars.mono,
+ fontSize: "0.85em",
+ color: vars.textDim,
+ whiteSpace: "nowrap",
+ }),
+
+ repoTabs: style({
+ display: "flex",
+ gap: "0.5rem",
+ margin: "0.75rem 0",
+ }),
+
+ tab: style({
+ padding: "0.2rem 0.7rem",
+ border: `1px solid ${vars.border}`,
+ borderRadius: vars.radius,
+ color: vars.textSoft,
+ }),
+
+ tabActive: style({
+ background: vars.surfaceHi,
+ color: vars.text,
+ fontWeight: 600,
+ }),
+
+ cloneBox: style({
+ margin: "1rem 0",
+ padding: "0.6rem 0.9rem",
+ background: vars.surface,
+ border: `1px solid ${vars.border}`,
+ borderRadius: vars.radius,
+ }),
+
+ cloneLabel: style({
+ color: vars.textMuted,
+ marginRight: "0.5rem",
+ }),
+
+ commitList: style({}),
+
+ commitDate: style({
+ fontFamily: vars.mono,
+ fontSize: "0.85em",
+ color: vars.textDim,
+ whiteSpace: "nowrap",
+ }),
+
+ commitSubject: style({}),
+
+ commitAuthor: style({ color: vars.textMuted }),
+
+ commitHash: style({
+ fontFamily: vars.mono,
+ fontSize: "0.85em",
+ color: vars.textDim,
+ }),
+
+ treeList: style({}),
+
+ treeMode: style({
+ fontFamily: vars.mono,
+ fontSize: "0.85em",
+ color: vars.textDim,
+ }),
+
+ treeName: style({}),
+
+ treeSize: style({
+ fontFamily: vars.mono,
+ fontSize: "0.85em",
+ color: vars.textDim,
+ textAlign: "right",
+ }),
+
+ code: style({
+ display: "block",
+ padding: "0.75rem 1rem",
+ background: vars.surface,
+ border: `1px solid ${vars.border}`,
+ borderRadius: vars.radius,
+ fontSize: "0.85rem",
+ color: vars.textSoft,
+ }),
+
+ commitMeta: style({
+ display: "grid",
+ gridTemplateColumns: "max-content 1fr",
+ gap: "0.2rem 1rem",
+ margin: "0.75rem 0",
+ }),
+
+ binaryNotice: style({ color: vars.textMuted }),
+
+ message: style({ color: vars.textMuted }),
+
+ badge: style({
+ display: "inline-block",
+ padding: "0.05rem 0.4rem",
+ marginLeft: "0.4rem",
+ borderRadius: 0,
+ border: `1px solid ${vars.border}`,
+ background: vars.surfaceHi,
+ fontFamily: vars.mono,
+ fontSize: "0.75em",
+ color: vars.textMuted,
+ verticalAlign: "middle",
+ }),
+
+ formRow: style({
+ display: "flex",
+ flexWrap: "wrap",
+ alignItems: "center",
+ gap: "0.5rem",
+ }),
+
+ grow: style({
+ flex: "1 1 12rem",
+ minWidth: 0,
+ }),
+
+ revPicker: style({
+ display: "flex",
+ flexWrap: "wrap",
+ alignItems: "center",
+ gap: "0.5rem",
+ margin: "0.75rem 0",
+ }),
+
+ empty: style({ color: vars.textDim }),
+
+ statusGood: style({ color: vars.success }),
+ statusWarn: style({ color: vars.accent }),
+ statusBad: style({ color: vars.danger }),
+ statusMuted: style({ color: vars.textDim }),
+
+ mirrorRow: style({
+ display: "grid",
+ gridTemplateColumns: "minmax(5rem, auto) minmax(9rem, auto) auto 1fr",
+ gap: "0.5rem 1rem",
+ alignItems: "baseline",
+ padding: "0.3rem 0",
+ "@media": {
+ "screen and (max-width: 40rem)": {
+ gridTemplateColumns: "1fr",
+ gap: "0.1rem",
+ paddingBottom: "0.6rem",
+ },
+ },
+ }),
+
+ mirrorKind: style({ color: vars.textSoft, fontWeight: 600 }),
+
+ siteFooter: style({
+ color: vars.textDim,
+ textAlign: "center",
+ padding: "2rem 0",
+ fontSize: "0.85em",
+ }),
+} as const;
+
+globalStyle(`${readme} > :first-child`, { marginTop: 0 });
+globalStyle(`${readme} > :last-child`, { marginBottom: 0 });
+
+globalStyle(
+ `${readme} h1, ${readme} h2, ${readme} h3, ${readme} h4, ${readme} h5, ${readme} h6`,
+ {
+ fontWeight: 600,
+ lineHeight: 1.25,
+ margin: "1.5rem 0 0.75rem",
+ },
+);
+
+globalStyle(`${readme} h1`, { fontSize: "1.5rem" });
+globalStyle(`${readme} h2`, { fontSize: "1.25rem" });
+globalStyle(`${readme} h3`, { fontSize: "1.05rem" });
+globalStyle(`${readme} h4, ${readme} h5, ${readme} h6`, {
+ fontSize: "0.95rem",
+ color: vars.textSoft,
+});
+
+globalStyle(`${readme} h1, ${readme} h2`, {
+ paddingBottom: "0.3rem",
+ borderBottom: `1px solid ${vars.border}`,
+});
+
+globalStyle(`${readme} p`, { margin: "0.75rem 0" });
+
+globalStyle(`${readme} code`, {
+ background: vars.surfaceHi,
+ padding: "0.12em 0.35em",
+ borderRadius: 0,
+ fontSize: "0.9em",
+});
+
+globalStyle(`${readme} pre`, {
+ margin: "0.75rem 0",
+ padding: "0.75rem 1rem",
+ background: vars.bgDeep,
+ border: `1px solid ${vars.border}`,
+ borderRadius: vars.radius,
+ overflowX: "auto",
+});
+
+globalStyle(`${readme} pre code`, {
+ background: "none",
+ padding: 0,
+ borderRadius: 0,
+ fontSize: "0.85rem",
+ color: vars.textSoft,
+});
+
+globalStyle(`${readme} blockquote`, {
+ margin: "0.75rem 0",
+ padding: "0.1rem 0 0.1rem 1rem",
+ borderLeft: `3px solid ${vars.border}`,
+ color: vars.textMuted,
+});
+
+// GitHub-style alerts: one accent colour per kind.
+const alertColor = {
+ note: "#4493f8",
+ tip: "#3fb950",
+ important: "#ab7df8",
+ warning: "#d29922",
+ caution: "#f85149",
+};
+
+globalStyle(`${readme} .md-alert`, {
+ margin: "0.75rem 0",
+ padding: "0.5rem 1rem",
+ borderLeft: `3px solid ${vars.border}`,
+ borderRadius: vars.radius,
+ color: vars.textSoft,
+});
+
+globalStyle(`${readme} .md-alert > :first-child`, { marginTop: 0 });
+
+globalStyle(`${readme} .md-alert > :last-child`, { marginBottom: 0 });
+
+globalStyle(`${readme} .md-alert-title`, {
+ display: "flex",
+ alignItems: "center",
+ gap: "0.4rem",
+ margin: "0 0 0.5rem",
+ fontWeight: 600,
+});
+
+globalStyle(`${readme} .md-alert-icon`, {
+ flexShrink: 0,
+ fill: "currentColor",
+});
+
+for (const [kind, color] of Object.entries(alertColor)) {
+ globalStyle(`${readme} .md-alert-${kind}`, {
+ borderLeftColor: color,
+ });
+
+ globalStyle(`${readme} .md-alert-${kind} .md-alert-title`, {
+ color,
+ });
+}
+
+globalStyle(`${readme} ul, ${readme} ol`, {
+ margin: "0.75rem 0",
+ paddingLeft: "1.5rem",
+});
+
+globalStyle(`${readme} li`, { margin: "0.25rem 0" });
+
+globalStyle(`${readme} li > input[type="checkbox"]`, {
+ marginRight: "0.35rem",
+});
+
+globalStyle(`${readme} hr`, {
+ border: 0,
+ borderTop: `1px solid ${vars.border}`,
+ margin: "1.5rem 0",
+});
+
+globalStyle(`${readme} img`, {
+ maxWidth: "100%",
+ verticalAlign: "middle",
+});
+
+globalStyle(`${readme} table`, {
+ display: "block",
+ width: "max-content",
+ maxWidth: "100%",
+ overflowX: "auto",
+ margin: "0.75rem 0",
+});
+
+globalStyle(`${readme} th[data-align="center"], ${readme} td[data-align="center"]`, {
+ textAlign: "center",
+});
+
+globalStyle(`${readme} th[data-align="right"], ${readme} td[data-align="right"]`, {
+ textAlign: "right",
+});
+
+globalStyle(`${readme} del`, { color: vars.textDim });
+
+// Inline pixel icons: crispEdges keeps the pixel grid sharp at any size.
+globalStyle(".icon", {
+ display: "inline-block",
+ verticalAlign: "middle",
+ flexShrink: 0,
+ fill: "currentColor",
+ shapeRendering: "crispEdges",
+});
+
+export type Classes = typeof classes;
diff --git a/src/styles/app.css.ts b/src/styles/app.css.ts
index 6041a13..ccb268d 100644
--- a/src/styles/app.css.ts
+++ b/src/styles/app.css.ts
@@ -378,6 +378,51 @@ globalStyle(`${readme} blockquote`, {
color: vars.textMuted,
});
+// GitHub-style alerts. One accent colour per kind drives the left border,
+// the title text, and the icon fill.
+const alertColor = {
+ note: "#4493f8",
+ tip: "#3fb950",
+ important: "#ab7df8",
+ warning: "#d29922",
+ caution: "#f85149",
+};
+
+globalStyle(`${readme} .md-alert`, {
+ margin: "0.75rem 0",
+ padding: "0.5rem 1rem",
+ borderLeft: `3px solid ${vars.border}`,
+ borderRadius: vars.radius,
+ color: vars.textSoft,
+});
+
+globalStyle(`${readme} .md-alert > :first-child`, { marginTop: 0 });
+
+globalStyle(`${readme} .md-alert > :last-child`, { marginBottom: 0 });
+
+globalStyle(`${readme} .md-alert-title`, {
+ display: "flex",
+ alignItems: "center",
+ gap: "0.4rem",
+ margin: "0 0 0.5rem",
+ fontWeight: 600,
+});
+
+globalStyle(`${readme} .md-alert-icon`, {
+ flexShrink: 0,
+ fill: "currentColor",
+});
+
+for (const [kind, color] of Object.entries(alertColor)) {
+ globalStyle(`${readme} .md-alert-${kind}`, {
+ borderLeftColor: color,
+ });
+
+ globalStyle(`${readme} .md-alert-${kind} .md-alert-title`, {
+ color,
+ });
+}
+
globalStyle(`${readme} ul, ${readme} ol`, {
margin: "0.75rem 0",
paddingLeft: "1.5rem",
@@ -418,4 +463,14 @@ globalStyle(`${readme} th[data-align="right"], ${readme} td[data-align="right"]`
globalStyle(`${readme} del`, { color: vars.textDim });
+// Inline pixel icons (see src/icons.ts). crispEdges keeps the pixel grid
+// sharp at any size; currentColor lets a parent's colour token drive the fill.
+globalStyle(".icon", {
+ display: "inline-block",
+ verticalAlign: "middle",
+ flexShrink: 0,
+ fill: "currentColor",
+ shapeRendering: "crispEdges",
+});
+
export type Classes = typeof classes;
diff --git a/src/styles/global.css-1.ts b/src/styles/global.css-1.ts
new file mode 100644
index 0000000..2a56196
--- /dev/null
+++ b/src/styles/global.css-1.ts
@@ -0,0 +1,66 @@
+/* Global element styling — the parts that must target bare elements (html,
+ * body, a, table, pre) rather than a generated class, so they live in
+ * globalStyle exactly like the personal site's base.css.ts.
+ */
+
+import { globalStyle } from "@vanilla-extract/css";
+import { vars } from "./theme.css";
+
+globalStyle("*", { boxSizing: "border-box" });
+
+globalStyle("html", {
+ background: `linear-gradient(135deg, ${vars.bg} 0%, ${vars.bgRaised} 60%, ${vars.bgDeep} 100%)`,
+ minHeight: "100%",
+});
+
+globalStyle("body", {
+ margin: 0,
+ minHeight: "100vh",
+ fontFamily: vars.font,
+ fontSize: "15px",
+ lineHeight: 1.5,
+ color: vars.text,
+ cursor: "url('/static/cursors/default-dark.png') 4 1, default",
+});
+
+globalStyle("a", {
+ color: vars.accent,
+ textDecoration: "none",
+});
+
+globalStyle("a:hover", { textDecoration: "underline" });
+
+// Self-hosted pixel cursor (dark art, since dough-git is always dark).
+globalStyle("a, button", {
+ cursor: "url('/static/cursors/pointer-dark.png') 12 1, pointer",
+});
+
+globalStyle("h1, h2, h3", {
+ fontWeight: 600,
+ lineHeight: 1.25,
+});
+
+globalStyle("table", {
+ width: "100%",
+ borderCollapse: "collapse",
+});
+
+globalStyle("th, td", {
+ textAlign: "left",
+ padding: "0.4rem 0.6rem",
+ borderBottom: `1px solid ${vars.border}`,
+ verticalAlign: "top",
+});
+
+globalStyle("th", {
+ color: vars.textMuted,
+ fontWeight: 600,
+ fontSize: "0.85em",
+});
+
+globalStyle("code, pre", { fontFamily: vars.mono });
+
+globalStyle("pre", {
+ margin: 0,
+ overflowX: "auto",
+});
diff --git a/src/styles/global.css.ts b/src/styles/global.css.ts
index f74946e..7a6590c 100644
--- a/src/styles/global.css.ts
+++ b/src/styles/global.css.ts
@@ -20,6 +20,7 @@ globalStyle("body", {
fontSize: "15px",
lineHeight: 1.5,
color: vars.text,
+ cursor: "url('/static/cursors/default-dark.png') 4 1, default",
});
globalStyle("a", {
@@ -29,6 +30,13 @@ globalStyle("a", {
globalStyle("a:hover", { textDecoration: "underline" });
+// Pixel cursors, self-hosted from public/cursors/ (served at /static/cursors/).
+// dough-git is always dark, so the dark cursor art is the plain default.
+// The trailing keyword is the fallback if the image is ever missing.
+globalStyle("a, button", {
+ cursor: "url('/static/cursors/pointer-dark.png') 12 1, pointer",
+});
+
globalStyle("h1, h2, h3", {
fontWeight: 600,
lineHeight: 1.25,
diff --git a/test/icons.test.mjs b/test/icons.test.mjs
new file mode 100644
index 0000000..b25842b
--- /dev/null
+++ b/test/icons.test.mjs
@@ -0,0 +1,79 @@
+// Tests for the inline icon helper.
+//
+// icon() reads from the installed pixelarticons package at call time, so these
+// checks pin the contract views.ts relies on: a real icon name yields one
+// <svg> that inherits colour and stays crisp, the size argument is honoured,
+// and an unknown name fails loudly rather than rendering nothing.
+//
+// Run: node --experimental-strip-types test/icons.test.mjs
+
+import { icon } from "../src/icons.ts";
+
+let failures = 0;
+function check(label, cond) {
+ console.log(`${cond ? "PASS" : "FAIL"} ${label}`);
+ if (!cond) failures++;
+}
+
+// The pixelarticons names dough-git actually uses.
+const names = [
+ "git-branch",
+ "git-commit",
+ "git-merge",
+ "git-pull-request",
+ "folder",
+ "file-text",
+ "code",
+ "lock",
+ "unlock",
+ "eye",
+ "eye-off",
+ "user",
+ "users",
+ "download",
+ "github",
+ "bookmark",
+ "clock",
+];
+
+for (const name of names) {
+ const svg = icon(name);
+ check(`${name} renders one svg`, (svg.match(/<svg /g) ?? []).length === 1);
+ check(`${name} has at least one path`, svg.includes("<path "));
+}
+
+check(
+ "default size is 16",
+ icon("folder").includes('width="16"') && icon("folder").includes('height="16"'),
+);
+check(
+ "an explicit size is honoured",
+ icon("lock", 24).includes('width="24"'),
+);
+check(
+ "the 24x24 grid is carried through",
+ names.every((name) => icon(name).includes('viewBox="0 0 24 24"')),
+);
+check(
+ "icons carry the .icon class for styling",
+ icon("user").includes('class="icon"'),
+);
+check(
+ "icons are decorative to screen readers",
+ icon("user").includes('aria-hidden="true"'),
+);
+check(
+ "colour is inherited, not hard-coded",
+ !icon("git-branch").includes("fill="),
+);
+
+let threw = false;
+try {
+ icon("definitely-not-an-icon");
+} catch {
+ threw = true;
+}
+check("an unknown name throws rather than rendering nothing", threw);
+
+console.log(failures === 0 ? "\nALL PASSED" : `\n${failures} FAILED`);
+process.exit(failures === 0 ? 0 : 1);
diff --git a/test/markdown.test.mjs b/test/markdown.test.mjs
index fb437f2..299a8a2 100644
--- a/test/markdown.test.mjs
+++ b/test/markdown.test.mjs
@@ -62,6 +62,63 @@ check("setext heading", has("Title\n=====", "<h1>Title</h1>"));
check("paragraph", has("just words", "<p>just words</p>"));
check("horizontal rule", has("---\n", "<hr>"));
check("blockquote", has("> quoted", "<blockquote>"));
+check(
+ "a plain blockquote is not treated as an alert",
+ has("> quoted", "<blockquote>") && lacks("> quoted", "md-alert"),
+);
+
+check(
+ "note alert renders as a titled alert, not a blockquote",
+ has("> [!NOTE]\n> Heads up.", 'class="md-alert md-alert-note"') &&
+ lacks("> [!NOTE]\n> Heads up.", "<blockquote>"),
+);
+check(
+ "note alert carries its title and body",
+ has("> [!NOTE]\n> Heads up.", ">Note</p>") &&
+ has("> [!NOTE]\n> Heads up.", "Heads up."),
+);
+check(
+ "note alert includes an inline icon",
+ has("> [!NOTE]\n> Heads up.", 'class="md-alert-icon"'),
+);
+check(
+ "tip alert",
+ has("> [!TIP]\n> Handy.", 'class="md-alert md-alert-tip"'),
+);
+check(
+ "important alert",
+ has("> [!IMPORTANT]\n> Read this.", 'class="md-alert md-alert-important"'),
+);
+check(
+ "warning alert",
+ has("> [!WARNING]\n> Careful.", 'class="md-alert md-alert-warning"'),
+);
+check(
+ "caution alert",
+ has("> [!CAUTION]\n> Danger.", 'class="md-alert md-alert-caution"'),
+);
+check(
+ "alert marker is case-insensitive",
+ has("> [!note]\n> lower.", 'class="md-alert md-alert-note"'),
+);
+check(
+ "an unknown marker stays a plain blockquote",
+ has("> [!HINT]\n> nope.", "<blockquote>") &&
+ lacks("> [!HINT]\n> nope.", "md-alert"),
+);
+check(
+ "a marker with trailing text is not an alert",
+ lacks("> [!NOTE] inline text", "md-alert"),
+);
+check(
+ "alert body renders markdown",
+ has("> [!NOTE]\n> Has **bold** text.", "<strong>bold</strong>"),
+);
+check(
+ "alert markup can't be forged from README content",
+ lacks("plain [!NOTE] not in a quote", "md-alert"),
+);
+
check(
"fenced code keeps its content verbatim",
has("```js\nconst a = 1;\n```", "const a = 1;"),