Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| Usage, Billing settings and prepaid AI credit; fixes from the UX audit | 1 | import assert from "node:assert/strict"; |
| 2 | import { test } from "node:test"; | |
| 3 | ||
| 4 | import { inlineParts, inlinePlain } from "./inline-markdown.ts"; | |
| 5 | ||
| 6 | test("bold, italic, code and links read as marks", () => { | |
| 7 | assert.deepEqual(inlineParts("**Conflict resolved.** The conflict was in `module.exports`."), [ | |
| 8 | { kind: "strong", text: "Conflict resolved." }, | |
| 9 | { kind: "text", text: " The conflict was in " }, | |
| 10 | { kind: "code", text: "module.exports" }, | |
| 11 | { kind: "text", text: "." }, | |
| 12 | ]); | |
| 13 | assert.deepEqual(inlineParts("in sudo (**Platform → Incidents**, `https://sudo.g1t.sh/incidents`)"), [ | |
| 14 | { kind: "text", text: "in sudo (" }, | |
| 15 | { kind: "strong", text: "Platform → Incidents" }, | |
| 16 | { kind: "text", text: ", " }, | |
| 17 | { kind: "code", text: "https://sudo.g1t.sh/incidents" }, | |
| 18 | { kind: "text", text: ")" }, | |
| 19 | ]); | |
| 20 | assert.deepEqual(inlineParts("an *important* step, see [the docs](https://docs.g1t.sh/)"), [ | |
| 21 | { kind: "text", text: "an " }, | |
| 22 | { kind: "em", text: "important" }, | |
| 23 | { kind: "text", text: " step, see the docs" }, | |
| 24 | ]); | |
| 25 | }); | |
| 26 | ||
| 27 | test("what is not a mark stays as written", () => { | |
| 28 | assert.deepEqual(inlineParts("snake_case_name and 2 * 3 * 4"), [{ kind: "text", text: "snake_case_name and 2 * 3 * 4" }]); | |
| 29 | assert.deepEqual(inlineParts("**Conflicts resolved:**"), [{ kind: "strong", text: "Conflicts resolved:" }]); | |
| 30 | assert.deepEqual(inlineParts(""), []); | |
| 31 | // Inside code, nothing else is read. | |
| 32 | assert.deepEqual(inlineParts("`a **b** c`"), [{ kind: "code", text: "a **b** c" }]); | |
| 33 | }); | |
| 34 | ||
| 35 | test("the plain words, for a tooltip", () => { | |
| 36 | assert.equal(inlinePlain("**Done.** Wrote `math.js`."), "Done. Wrote math.js."); | |
| 37 | }); |