Edits to the open document (a file whose kind is DOC). Edits apply live for anyone viewing the document. Requires edit access. Call as {"action": "<name>", "params": {...}}.
Read the document first (doc_read): paths shift as blocks are added or removed, and replace_blocks / delete_blocks must pass each block's hash from that read — if a block changed since, the edit is refused and nothing changes. Every edit returns the paths and hashes of the blocks it wrote, and saved: false if it hadn't been confirmed yet (it is still applied).
content is Markdown by default (headings, emphasis, links, lists, quotes, code, tables, images, ---), or ProseMirror JSON with format: "json". Keep any <qd-node .../> placeholders from read_doc when writing content back; they stand for footnotes, comments and other content Markdown can't express.
Actions:
• append(content, format?) — Add blocks at the end.
• insert_blocks(position, path?, hash?, content, format?) — position: "start", "end", "before" or "after"; before/after need the anchor block's path.
• replace_blocks(blocks, content, format?) — Replace consecutive blocks in one section; blocks: [{path, hash}, ...].
• delete_blocks(blocks) — Delete consecutive blocks in one section; blocks: [{path, hash}, ...].
• find_replace(find, replace, case_sensitive?, whole_word?, regex?) — Replace text throughout; replacements keep the formatting of the text they replace.
• batch(operations) — Up to 100 edits as one all-or-nothing change: {"operations": [{"action": "<name>", "params": {...}}, ...]}. Paths in later operations refer to the document as earlier ones left it.