Skip to content

Commit 205072f

Browse files
committed
fix: copy formatting
1 parent cd684b2 commit 205072f

5 files changed

Lines changed: 9 additions & 29 deletions

File tree

README.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ if (result) {
4444
// result.html is a ready-made snippet
4545
// or use result.title, result.summary, result.steps, result.patch, result.trace
4646
} else {
47-
// no friendly explanation show the original traceback as-is
47+
// no friendly explanation - show the original traceback as-is
4848
}
4949

5050
// if the trace reports an unhelpful source location (eg. Pyodide runs code as "<exec>"), pass file explicitly to override what's parsed from the trace:
@@ -70,7 +70,7 @@ See the [demo](docs/README.md) for a full set of examples.
7070

7171
`result.html` is built to be accessible by default (with WCAG 2.1 AA in mind):
7272

73-
- The whole explanation is one labelled group `<div class="pfem" role="group" lang="…" aria-labelledby="…">`, named by its title, with `lang` taken from the copydeck so screen readers pronounce localised copy correctly (`3.1.2 Language of Parts`). `role="group"` (not a landmark) keeps things uncluttered when several explanations render on one page
73+
- The whole explanation is one labelled group: `<div class="pfem" role="group" lang="…" aria-labelledby="…">`, named by its title, with `lang` taken from the copydeck so screen readers pronounce localised copy correctly (`3.1.2 Language of Parts`). `role="group"` (not a landmark) keeps things uncluttered when several explanations render on one page
7474
- The title is deliberately not a heading. Heading level depends on the surrounding page outline, which a library can't know, so the title supplies the group's accessible name instead. If you want it in your heading outline, render your own heading from `result.title` and use `result.html` (or the structured fields) for the body
7575
- Code is marked up as code; inline tokens use `<code>` and blocks use `<pre><code>`
7676
- The suggested fix has a visible "Suggested fix" label; the original traceback stays in a native `<details>`/`<summary>`
@@ -162,14 +162,10 @@ The script:
162162
6. pushes the commits and tag, and
163163
7. creates a GitHub Release with notes generated from the commits/PRs since the previous tag.
164164

165-
If `npm publish` fails, nothing is pushed the script prints how to undo the local
165+
If `npm publish` fails, nothing is pushed - the script prints how to undo the local
166166
bump and retry.
167167

168168
### Prerequisites (one-time)
169169

170-
- `npm login` — publishing uses your local npm credentials (the package publishes
171-
publicly via `publishConfig.access: "public"`).
172-
- `gh auth login` — the GitHub Release is created with the `gh` CLI.
173-
174-
Tests still run automatically on every push to `main` and on pull requests via
175-
[`.github/workflows/ci.yml`](.github/workflows/ci.yml).
170+
- `npm login`: publishing uses your local npm credentials (the package publishes publicly via `publishConfig.access: "public"`)
171+
- `gh auth login`: the GitHub Release is created with the `gh` CLI

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ <h1>Python Friendly Error Messages - Demo</h1>
123123
}
124124
const result = friendlyExplain({ error: parsedTrace, code: example.code });
125125
if (!result) {
126-
throw new Error('No friendly mapping for this error nothing to show.');
126+
throw new Error('No friendly mapping for this error - nothing to show.');
127127
}
128128
processedExamples.push({ example, trace, result, error: null });
129129
} catch (err) {

docs/styles.css

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ h1 {
128128
line-height: 1.6;
129129
}
130130

131-
/* inline code tokens share a monospace pill; the tint varies by token type */
132131
.pfem__var,
133132
.pfem__code,
134133
.pfem__file {
@@ -138,20 +137,17 @@ h1 {
138137
border-radius: 0.25rem;
139138
}
140139

141-
/* variable names & the offending code line — purple */
142140
.pfem__var,
143141
.pfem__code {
144142
background: #efe8ff;
145143
color: #5b3f99;
146144
}
147145

148-
/* file name — teal */
149146
.pfem__file {
150147
background: #e0f2f1;
151148
color: #00695c;
152149
}
153150

154-
/* line-number token — not code, so a proportional pill in a warm amber */
155151
.pfem__line {
156152
font-weight: 600;
157153
font-size: 0.9em;
@@ -353,7 +349,7 @@ h1 {
353349
}
354350

355351
/* ═══════════════════════════════════════════════════════════
356-
Anatomy page docs/anatomy.html
352+
Anatomy page - docs/anatomy.html
357353
═══════════════════════════════════════════════════════════ */
358354

359355
:root {
@@ -369,14 +365,12 @@ h1 {
369365
--err: #db0b0b;
370366
}
371367

372-
/* ── Page ── */
373368
.anatomy {
374369
max-width: 64rem;
375370
margin: 0 auto;
376371
padding: 1.25rem 1.5rem 1.5rem;
377372
}
378373

379-
/* ── Back link ── */
380374
.anatomy__back {
381375
display: inline-flex;
382376
align-items: center;
@@ -392,7 +386,6 @@ h1 {
392386
color: #111827;
393387
}
394388

395-
/* ── Header ── */
396389
.anatomy__header {
397390
text-align: center;
398391
margin-bottom: 1.25rem;
@@ -416,7 +409,6 @@ h1 {
416409
margin: 0 auto;
417410
}
418411

419-
/* ── Two-column layout ── */
420412
.anatomy__main {
421413
display: grid;
422414
grid-template-columns: 1fr 21rem;
@@ -429,7 +421,6 @@ h1 {
429421
top: 1.25rem;
430422
}
431423

432-
/* ── Traceback context strip ── */
433424
.anatomy__context {
434425
background: #fff;
435426
border-radius: 0.75rem 0.75rem 0 0;
@@ -456,7 +447,6 @@ h1 {
456447
line-height: 1.6;
457448
}
458449

459-
/* ── Error card ── */
460450
.anatomy__card {
461451
background: #fff;
462452
border-radius: 0 0 0.75rem 0.75rem;
@@ -465,7 +455,6 @@ h1 {
465455
margin-bottom: 0;
466456
}
467457

468-
/* ── Stage ── */
469458
.anatomy__zone {
470459
padding: 0.875rem 1.125rem;
471460
border-left: 4px solid #e5e7eb;
@@ -536,7 +525,6 @@ h1 {
536525
.anatomy__zone[data-zone="3"].is-revealed .anatomy__zone-tag { color: var(--z2-light); }
537526
.anatomy__zone[data-zone="4"].is-revealed .anatomy__zone-tag { color: var(--z4-light); }
538527

539-
/* Stage body reveal animation */
540528
.anatomy__zone-body {
541529
transition: opacity 0.45s ease, filter 0.45s ease, transform 0.45s ease;
542530
}
@@ -559,15 +547,13 @@ h1 {
559547
animation: zoneIn 0.45s ease forwards;
560548
}
561549

562-
/* pfem overrides inside stages */
563550
.anatomy__zone .pfem__title { font-size: 1rem; margin-bottom: 0.35rem; }
564551
.anatomy__zone .pfem__summary { margin-bottom: 0; font-size: 0.9rem; }
565552
.anatomy__zone .pfem__why { margin: 0; border-radius: 0.375rem; padding: 0.625rem 0.875rem; }
566553
.anatomy__zone .pfem__patch { margin: 0; padding: 0.625rem 0.875rem; }
567554
.anatomy__zone .pfem__steps { margin: 0; }
568555
.anatomy__zone .pfem__steps li { font-size: 0.9rem; margin-bottom: 0.25rem; }
569556

570-
/* ── Description panel ── */
571557
.anatomy__desc {
572558
background: #fff;
573559
border-radius: 0.75rem;
@@ -592,7 +578,6 @@ h1 {
592578
line-height: 1.65;
593579
}
594580

595-
/* ── Controls ── */
596581
.anatomy__controls {
597582
display: flex;
598583
align-items: center;
@@ -628,7 +613,6 @@ h1 {
628613
.anatomy__btn--ghost { background: transparent; color: #9ca3af; font-weight: 500; }
629614
.anatomy__btn--ghost:hover { color: #6b7280; }
630615

631-
/* ── Print: reveal everything ── */
632616
@media print {
633617
.anatomy__controls { display: none; }
634618
.anatomy__zone-body { opacity: 1 !important; filter: none !important; transform: none !important; }

scripts/import_copydeck_csv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Reads a reviewed CSV (originally produced by export_copydeck_csv.py, then edited
55
in a spreadsheet) and updates title/summary/why/steps for each variant, writing
66
the result to a JSON file. The original if_condition and any other metadata are
7-
preserved from the source copydeck reviewers cannot change match logic.
7+
preserved from the source copydeck - reviewers cannot change match logic.
88
99
The reader tolerates the mutations a spreadsheet round-trip introduces:
1010
* blank rows above the header (e.g. a frozen spacer row)

src/engine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export const friendlyExplain = (opts: ExplainOptions): ExplainResult | null => {
152152
const code = opts.code;
153153

154154
const trace = coerceTrace(opts.error, code, opts.runtime);
155-
// The error could not be parsed no friendly explanation; caller uses the raw error
155+
// The error could not be parsed - no friendly explanation; caller uses the raw error
156156
if (!trace) return null;
157157

158158
// Caller-provided file/line take precedence over whatever was parsed from the trace

0 commit comments

Comments
 (0)