rapier-html 1.1.14 → 1.1.21
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 +4 -4
- package/README.md +34 -70
- package/package.json +1 -1
- package/page.mjs +4 -1
- package/rapier.html +217 -27
package/BUILD.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"package": "rapier-html",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.21",
|
|
4
4
|
"path": "rapier.html",
|
|
5
|
-
"bytes":
|
|
6
|
-
"sha256": "
|
|
7
|
-
"builtAt": "2026-09-
|
|
5
|
+
"bytes": 1551980,
|
|
6
|
+
"sha256": "2ff760ab90f2eeb4b7afae6cd2eb2acf23d0479823c9a57b1ad16cb3cd509220",
|
|
7
|
+
"builtAt": "2026-09-30T16:20:55.079Z",
|
|
8
8
|
"node": "v22.22.2",
|
|
9
9
|
"canonical": true,
|
|
10
10
|
"packing": "zopfli",
|
package/README.md
CHANGED
|
@@ -4,75 +4,40 @@ Rapier, the offline Markdown editor, as one HTML page with your document inside
|
|
|
4
4
|
install, nothing fetched to open, edit or save. Node 22 or newer.
|
|
5
5
|
|
|
6
6
|
```sh
|
|
7
|
-
npx -- rapier-html@1.1.
|
|
8
|
-
npx -- rapier-html@1.1.
|
|
9
|
-
npx -- rapier-html@1.1.
|
|
10
|
-
npx -- rapier-html@1.1.
|
|
11
|
-
npx -- rapier-html@1.1.
|
|
12
|
-
npx -- rapier-html@1.1.
|
|
13
|
-
npx -- rapier-html@1.1.
|
|
14
|
-
npm install rapier-html@1.1.
|
|
7
|
+
npx -- rapier-html@1.1.21 notes.md # the editor, notes.md inside it, written beside the file
|
|
8
|
+
npx -- rapier-html@1.1.21 notes.md --view draw # opens on Draw: sketch and paint, the document behind it
|
|
9
|
+
npx -- rapier-html@1.1.21 notes.md --view notes # opens on Notes: the document as cards
|
|
10
|
+
npx -- rapier-html@1.1.21 notes.md --drawing sketch.svg # carries a drawing, opened on Draw over the document
|
|
11
|
+
npx -- rapier-html@1.1.21 proposal.md --base original.md # opens on the diff of a proposed change
|
|
12
|
+
npx -- rapier-html@1.1.21 notes.md --return "$RETURN_URL" --return-expires-at "$RETURN_EXPIRES_AT" # Send back
|
|
13
|
+
npx -- rapier-html@1.1.21 notes.md out.html # a named output
|
|
14
|
+
npm install rapier-html@1.1.21 # as a library: wrap, unwrap
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
The first `--` is for npm, so `--help` reaches the command. It never overwrites a file.
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
around text.
|
|
24
|
-
- Find and replace, Undo, a source view of the exact bytes.
|
|
25
|
-
- Supported Mermaid flowchart fences draw offline in Rapier's look, so an agent can write a fence or use figures; other diagrams and math use optional plugins.
|
|
26
|
-
|
|
27
|
-
**Draw and paint**
|
|
28
|
-
- Shapes, lines, arrows, text on a canvas that goes into the document as a picture.
|
|
29
|
-
- Paint with real brushes: pencil, pen, ink, watercolour that runs and dries, oil that mixes, a smudge
|
|
30
|
-
finger; dip the brush for more paint or more water.
|
|
31
|
-
- Your own brush files, a dropper, paint laid over the drawing as a layer of its own.
|
|
32
|
-
|
|
33
|
-
**Notes**
|
|
34
|
-
- The document as cards: sections, drag to reorder, search across every note.
|
|
35
|
-
- Voice recordings, reminders, a recycle bin that keeps seven days.
|
|
36
|
-
- Import from Keep, Notion, Evernote, Joplin, Bear, Simplenote, OneNote, Obsidian and more.
|
|
37
|
-
|
|
38
|
-
**Review a change**
|
|
39
|
-
- Open on the diff of a proposal against the original; keep or drop each change; nothing applies until
|
|
40
|
-
the person says so.
|
|
41
|
-
- Will markers in the Markdown say what an agent may change: `keep`, `append`, `edit`.
|
|
42
|
-
|
|
43
|
-
**Keep it**
|
|
44
|
-
- Save to the device, share the page on, open it again anywhere a browser is; offline throughout.
|
|
45
|
-
- Export the document as Markdown or as a web page; print it.
|
|
46
|
-
|
|
47
|
-
**For agents**
|
|
48
|
-
- Hand a person a document, a sketch or a change as one file that opens with one click.
|
|
49
|
-
- What they save comes back byte for byte through `unwrap`.
|
|
50
|
-
- Add the return URL from `document.create_return`: the person edits the page and presses Send back;
|
|
51
|
-
`document.wait_for_user` wakes the agent, which reads the exact returned Markdown and continues.
|
|
19
|
+
The page is the whole editor: write, draw and paint, the document as Notes cards, Find and replace, Undo, a
|
|
20
|
+
source view of the exact bytes; save to the device, share the page on, export Markdown or a web page, print; all
|
|
21
|
+
offline. Opened with `--base` it shows the diff of a proposal against the original, and the person keeps or drops
|
|
22
|
+
each change. Will markers in the Markdown say what an agent may change: `keep`, `append`, `edit`.
|
|
52
23
|
|
|
53
24
|
## Send an edited document back
|
|
54
25
|
|
|
55
|
-
Call `document.create_return` on the Rapier agent door for the document's workspace
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
The person reads and edits offline, then presses Send back when ready. That press sends the current
|
|
62
|
-
source and filename once, and shows acceptance or the worker's refusal. After acceptance, that page
|
|
63
|
-
sends nothing again. Save to the device stays local. The return URL lasts up to one day, accepts one
|
|
64
|
-
document up to 25 MiB, and grants no read or edit access to the agent's workspace.
|
|
26
|
+
Call `document.create_return` on the Rapier agent door for the document's workspace and pass its `return_url`
|
|
27
|
+
and `return_expires_at` as `--return "$RETURN_URL" --return-expires-at "$RETURN_EXPIRES_AT"`, or
|
|
28
|
+
`wrap(..., {return: return_url, return_expires_at})`. Only the worker's HTTPS return route at
|
|
29
|
+
`https://mcp.rapier.website/return/…` is accepted. The page then shows Send back in Share; a page without an
|
|
30
|
+
address has no such action.
|
|
65
31
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
handoff; the old capability stays spent.
|
|
32
|
+
The person edits offline and presses Send back: the current source and filename go once, the page shows the
|
|
33
|
+
acceptance or the worker's refusal, and it sends nothing again. The return lasts up to one day, takes one
|
|
34
|
+
document up to 25 MiB and grants no access to the agent's workspace. After the expiry, or a refusal, Share offers
|
|
35
|
+
Save instead; bring that file back to the assistant for a fresh return.
|
|
71
36
|
|
|
72
|
-
The agent's `document.wait_for_user` returns a `returned` receipt with the `return_id`, name and time
|
|
73
|
-
`document.get_context` lists receipts
|
|
74
|
-
|
|
75
|
-
|
|
37
|
+
The agent's `document.wait_for_user` returns a `returned` receipt with the `return_id`, name and time;
|
|
38
|
+
`document.get_context` lists receipts; `document.read_context({return_id, start: 0})` reads the source,
|
|
39
|
+
continuing at the returned `end` until `complete`. The returned copy stays separate from the workspace's
|
|
40
|
+
current document.
|
|
76
41
|
|
|
77
42
|
## As a library
|
|
78
43
|
|
|
@@ -89,9 +54,9 @@ console.log('words back exactly:', unwrap(page).text === words);
|
|
|
89
54
|
await writeFile('hello.rapier.html', page, {flag: 'wx'}); // 'wx': never over an existing file
|
|
90
55
|
```
|
|
91
56
|
|
|
92
|
-
`wrap(rapierHtml, text, name, {view, drawing, drawingName, base, baseName, return: returnURL, return_expires_at})`
|
|
93
|
-
|
|
94
|
-
|
|
57
|
+
`wrap(rapierHtml, text, name, {view, drawing, drawingName, base, baseName, return: returnURL, return_expires_at})`
|
|
58
|
+
and `unwrap(pageHtml)`, which returns the same fields with `null` for what a page does not carry. Also exported:
|
|
59
|
+
`encodeCarried`, `decodeCarried`, `main`.
|
|
95
60
|
|
|
96
61
|
## How the page carries the document
|
|
97
62
|
|
|
@@ -105,13 +70,12 @@ fact of the file and written back on Save.
|
|
|
105
70
|
|
|
106
71
|
## Safety
|
|
107
72
|
|
|
108
|
-
- It never overwrites: an output
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
- Nothing reports on the page's use. It reaches the network only when the document or the person asks:
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
credentials, query strings and fragments are refused by both the writer and carried-page boot.
|
|
73
|
+
- It never overwrites: an existing output, the document itself included, is refused, as are unknown options, a
|
|
74
|
+
`--view` other than `draw` or `notes`, a `--drawing` or `--base` with no file, a return without its expiry, an
|
|
75
|
+
invalid expiry, an unsafe return URL and a third filename.
|
|
76
|
+
- Nothing reports on the page's use. It reaches the network only when the document or the person asks: a linked
|
|
77
|
+
picture or video, the maths, diagram and PDF-import helpers on first use, or Send back. A return URL names only
|
|
78
|
+
the worker's exact origin and route; credentials, query strings and fragments are refused.
|
|
115
79
|
|
|
116
80
|
## Licence
|
|
117
81
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rapier-html",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.21",
|
|
4
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.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|
package/page.mjs
CHANGED
|
@@ -7,6 +7,9 @@ const DRAWING_START = '<script type="text/plain" id="rapier-drawing"';
|
|
|
7
7
|
// The text the document was proposed against (docs/page-door.md, "2. A change carried"): the page opens on its diff.
|
|
8
8
|
const BASE_START = '<script type="text/markdown" id="rapier-base"';
|
|
9
9
|
const END = '</script>';
|
|
10
|
+
// The page's search words (rapier.html's RAPIER_SEO regions: description, canonical address, previews, structured data and the plain guide
|
|
11
|
+
// a crawler reads) are rapier.website's own. A page that carries someone's document never claims that address or that description.
|
|
12
|
+
const SEARCH_WORDS = /<!-- RAPIER_SEO_BEGIN -->[\s\S]*?<!-- RAPIER_SEO_END -->\n?/g;
|
|
10
13
|
|
|
11
14
|
// One encoding, exactly reversible (docs/page-door.md, "What a block may hold"): no `<` before `/` or `!`, no CR, no NUL.
|
|
12
15
|
// engine.js _rapierDecodeCarried is its inverse.
|
|
@@ -46,7 +49,7 @@ export function wrap(pageHtml, text, name, options) {
|
|
|
46
49
|
if (typeof opts.base !== 'string') throw new Error('the base must be text');
|
|
47
50
|
carriedBlocks += '\n' + BASE_START + ' data-name="' + safeName(opts.baseName, docName) + '">' + encodeCarried(opts.base) + END;
|
|
48
51
|
}
|
|
49
|
-
const stripped = unwrap(pageHtml).html;
|
|
52
|
+
const stripped = unwrap(pageHtml).html.replace(SEARCH_WORDS, '');
|
|
50
53
|
// Before Rapier's scripts: parsed before the engine boots.
|
|
51
54
|
const bodyTag = /<body[^>]*>/.exec(stripped);
|
|
52
55
|
if (!bodyTag) throw new Error('not a Rapier page: no <body>');
|