···11+---
22+name: hedgedoc
33+description: 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.
44+---
55+66+# HedgeDoc Pad Skill
77+88+Manage HedgeDoc pads on `pad.lassul.us` — create, read, and edit collaborative markdown documents.
99+1010+## Instance
1111+1212+- **URL**: `https://pad.lassul.us`
1313+- **Access**: Anonymous (no auth required)
1414+1515+## Script
1616+1717+Use `./pad.sh <command>` (scripts are next to this SKILL.md):
1818+1919+### Read a pad
2020+```bash
2121+./pad.sh read <pad-id>
2222+```
2323+2424+### Create a new pad
2525+```bash
2626+# From stdin
2727+echo "# My Document" | ./pad.sh create
2828+2929+# From a file
3030+./pad.sh create /path/to/file.md
3131+```
3232+Returns the new pad URL.
3333+3434+### Edit a pad (in-place)
3535+```bash
3636+# From stdin
3737+echo "# Updated content" | ./pad.sh edit <pad-id>
3838+3939+# From a file
4040+./pad.sh edit <pad-id> /path/to/file.md
4141+```
4242+Edits the pad in-place via the HedgeDoc websocket API (socket.io + OT). No new pad created.
4343+4444+### Get pad info
4545+```bash
4646+./pad.sh info <pad-id>
4747+```
4848+Returns JSON with title, description, viewcount, timestamps.
4949+5050+## Typical Workflow
5151+5252+1. **Read** the pad: `pad.sh read <id>` → get current markdown
5353+2. **Edit** locally: save modified content to a temp file
5454+3. **Write back**: `pad.sh edit <id> /tmp/updated.md`
5555+4. **Share**: `https://pad.lassul.us/<id>`
5656+5757+## How it works
5858+5959+The 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.
6060+6161+## Mermaid Diagrams
6262+6363+HedgeDoc renders Mermaid diagrams natively. Use fenced code blocks:
6464+6565+````markdown
6666+```mermaid
6767+graph LR
6868+ A --> B --> C
6969+```
7070+````
7171+7272+Prefer Mermaid over ASCII art for architecture diagrams, flowcharts, etc. in pads.
7373+7474+**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.
7575+7676+## Notes
7777+7878+- `allowFreeURL = true` — pads can have custom slugs
7979+- `defaultPermission = "freely"` — all pads are world-editable via URL
8080+- Edit replaces the entire pad content (full replacement, not partial edit)
8181+- Active browser sessions will see the change in real-time (pushed via socket.io)
8282+- Pad IDs are from the URL: `https://pad.lassul.us/{PADID}`
8383+- Edit uses UTF-16 code unit counting (JavaScript string length) for OT operations