This repository has no description
2.7 kB
83 lines
1---
2name: hedgedoc
3description: Manage HedgeDoc pads on pad.lassul.us — create, read, edit, and get info on collaborative markdown documents. Use when the user wants to work with pads, notes, or shared documents.
4---
5
6# HedgeDoc Pad Skill
7
8Manage HedgeDoc pads on `pad.lassul.us` — create, read, and edit collaborative markdown documents.
9
10## Instance
11
12- **URL**: `https://pad.lassul.us`
13- **Access**: Anonymous (no auth required)
14
15## Invocation
16
17Use `s skills.hedgedoc <command>` — this IS the pad script. Do NOT use `./pad.sh` directly.
18
19### Read a pad
20```bash
21s skills.hedgedoc read <pad-id>
22```
23
24### Create a new pad
25```bash
26# From stdin
27echo "# My Document" | s skills.hedgedoc create
28
29# From a file
30s skills.hedgedoc create /path/to/file.md
31```
32Returns the new pad URL.
33
34### Edit a pad (in-place)
35```bash
36# From stdin
37echo "# Updated content" | s skills.hedgedoc edit <pad-id>
38
39# From a file
40s skills.hedgedoc edit <pad-id> /path/to/file.md
41```
42Edits the pad in-place via the HedgeDoc websocket API (socket.io + OT). No new pad created.
43
44### Get pad info
45```bash
46s skills.hedgedoc info <pad-id>
47```
48Returns JSON with title, description, viewcount, timestamps.
49
50## Typical Workflow
51
521. **Read** the pad: `s skills.hedgedoc read <id>` → get current markdown
532. **Edit** locally: save modified content to a temp file
543. **Write back**: `s skills.hedgedoc edit <id> /tmp/updated.md`
554. **Share**: `https://pad.lassul.us/<id>`
56
57## How it works
58
59The edit command connects to HedgeDoc's socket.io websocket, receives the current document state and revision number, then sends an OT (operational transform) operation that deletes all existing content and inserts the new content. The server acknowledges with an `ack` event.
60
61## Mermaid Diagrams
62
63HedgeDoc renders Mermaid diagrams natively. Use fenced code blocks:
64
65````markdown
66```mermaid
67graph LR
68 A --> B --> C
69```
70````
71
72Prefer Mermaid over ASCII art for architecture diagrams, flowcharts, etc. in pads.
73
74**Always quote node labels with special characters** — labels containing `/`, `~`, `*`, `+`, `.`, `:`, `(`, `)` must use double quotes: `Node["~/Mail/new/"]` not `Node[~/Mail/new/]`. Unquoted special chars break Mermaid rendering.
75
76## Notes
77
78- `allowFreeURL = true` — pads can have custom slugs
79- `defaultPermission = "freely"` — all pads are world-editable via URL
80- Edit replaces the entire pad content (full replacement, not partial edit); empty content is refused
81- Active browser sessions will see the change in real-time (pushed via socket.io)
82- Pad IDs are from the URL: `https://pad.lassul.us/{PADID}`
83- Edit uses UTF-16 code unit counting (JavaScript string length) for OT operations