rapier-html 1.1.50 → 1.1.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/BUILD.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "package": "rapier-html",
3
- "version": "1.1.50",
3
+ "version": "1.1.51",
4
4
  "path": "rapier.html",
5
- "bytes": 1695129,
6
- "sha256": "c90c96249d982908e54af83c675e6fccfc2f20bed21115905490a6f29e5caf0d",
7
- "builtAt": "2026-10-03T14:29:34.350Z",
5
+ "bytes": 1695238,
6
+ "sha256": "0c0bee8e05c7bc5854d937ba04bbc9259e05992a8d487b04b4aaab289c8b6361",
7
+ "builtAt": "2026-10-03T15:36:59.572Z",
8
8
  "node": "v22.22.2",
9
9
  "canonical": true,
10
10
  "packing": "zopfli",
package/README.md CHANGED
@@ -1,17 +1,27 @@
1
1
  # rapier-html
2
2
 
3
- Rapier, the offline Markdown editor, as one HTML page with your document inside it. No account, no
4
- install, nothing fetched to open, edit or save. Node 22 or newer.
3
+ Give a person a document they can read, edit and keep: one command writes one HTML file that is the whole
4
+ editor, offline, with the document inside.
5
+
6
+ - The page writes, draws and paints, saves Markdown, exports a web page and prints, with no account and nothing
7
+ fetched to open, edit or save.
8
+ - `--return` adds a one-use Send back address from the agent door: the person edits offline, presses Send back,
9
+ and the agent reads the returned copy.
10
+ - `--view draw` opens on Draw; `--base original.md` opens on the diff of a proposed change, and the person keeps
11
+ or drops each change.
12
+ - `wrap` and `unwrap` carry a document into a page and out again, exactly, for programs.
13
+
14
+ Node 22 or newer.
5
15
 
6
16
  ```sh
7
- npx -- rapier-html@1.1.50 notes.md # the editor, notes.md inside it, written beside the file
8
- npx -- rapier-html@1.1.50 notes.md --view draw # opens on Draw: sketch and paint, the document behind it
9
- npx -- rapier-html@1.1.50 notes.md --view notes # opens the Notes library
10
- npx -- rapier-html@1.1.50 notes.md --drawing sketch.svg # carries a drawing, opened on Draw over the document
11
- npx -- rapier-html@1.1.50 proposal.md --base original.md # opens on the diff of a proposed change
12
- npx -- rapier-html@1.1.50 notes.md --return "$RETURN_URL" --return-expires-at "$RETURN_EXPIRES_AT" # Send back
13
- npx -- rapier-html@1.1.50 notes.md out.html # a named output
14
- npm install rapier-html@1.1.50 # as a library: wrap, unwrap
17
+ npx -- rapier-html@1.1.51 notes.md # the editor, notes.md inside it, written beside the file
18
+ npx -- rapier-html@1.1.51 notes.md --view draw # opens on Draw: sketch and paint, the document behind it
19
+ npx -- rapier-html@1.1.51 notes.md --view notes # opens the Notes library
20
+ npx -- rapier-html@1.1.51 notes.md --drawing sketch.svg # carries a drawing, opened on Draw over the document
21
+ npx -- rapier-html@1.1.51 proposal.md --base original.md # opens on the diff of a proposed change
22
+ npx -- rapier-html@1.1.51 notes.md --return "$RETURN_URL" --return-expires-at "$RETURN_EXPIRES_AT" # Send back
23
+ npx -- rapier-html@1.1.51 notes.md out.html # a named output
24
+ npm install rapier-html@1.1.51 # as a library: wrap, unwrap
15
25
  ```
16
26
 
17
27
  The first `--` is for npm, so `--help` reaches the command. It never overwrites a file.
package/package.json CHANGED
@@ -1,15 +1,26 @@
1
1
  {
2
2
  "name": "rapier-html",
3
- "version": "1.1.50",
4
- "description": "Rapier, the offline Markdown editor, as one HTML page with your document inside it: write, draw and paint, notes, the diff of a change; no account, nothing fetched.",
3
+ "version": "1.1.51",
4
+ "description": "Give a person a document they can read, edit and keep: one command writes one offline HTML file that is the whole Markdown editor with the document inside; draw, paint, review a diff, Send back to the agent.",
5
5
  "keywords": [
6
6
  "markdown",
7
7
  "editor",
8
8
  "offline",
9
9
  "single-file",
10
+ "self-contained",
10
11
  "html",
12
+ "document",
13
+ "cli",
11
14
  "agent",
12
15
  "mcp",
16
+ "claude",
17
+ "chatgpt",
18
+ "llm",
19
+ "send-back",
20
+ "review",
21
+ "diff",
22
+ "svg",
23
+ "drawing",
13
24
  "rapier"
14
25
  ],
15
26
  "author": "Jack Skipworth",
package/page.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {readFile, writeFile} from 'node:fs/promises';
2
2
  import {basename, dirname, join} from 'node:path';
3
- import {returnAddress, returnExpiresAt} from './return-address.mjs';
3
+ import {PAGE_SEED, returnAddress, returnExpiresAt} from './return-address.mjs';
4
4
 
5
5
  const START = '<script type="text/markdown" id="rapier-document"';
6
6
  const DRAWING_START = '<script type="text/plain" id="rapier-drawing"';
@@ -49,7 +49,12 @@ export function wrap(pageHtml, text, name, options) {
49
49
  if (typeof opts.base !== 'string') throw new Error('the base must be text');
50
50
  carriedBlocks += '\n' + BASE_START + ' data-name="' + safeName(opts.baseName, docName) + '">' + encodeCarried(opts.base) + END;
51
51
  }
52
- const stripped = unwrap(pageHtml).html.replace(SEARCH_WORDS, '');
52
+ // The agent seed goes after the charset (or <head>), once: a page that already carries it, wrapped again, loses its old one.
53
+ const unseeded = unwrap(pageHtml).html.replace(SEARCH_WORDS, '').split(PAGE_SEED + '\n').join('');
54
+ const headTag = /<meta charset[^>]*>\n?/i.exec(unseeded) || /<head[^>]*>\n?/.exec(unseeded);
55
+ if (!headTag) throw new Error('not a Rapier page: no <head>');
56
+ const seededAt = headTag.index + headTag[0].length;
57
+ const stripped = unseeded.slice(0, seededAt) + PAGE_SEED + '\n' + unseeded.slice(seededAt);
53
58
  // Before Rapier's scripts: parsed before the engine boots.
54
59
  const bodyTag = /<body[^>]*>/.exec(stripped);
55
60
  if (!bodyTag) throw new Error('not a Rapier page: no <body>');