patch_document
Surgically edit a document by applying block-level operations. Each operation targets a specific block by its blockId (use list_document_blocks to find IDs first). Operations: replace, insertBefore, insertAfter, delete. Applied in order; partial success possible. Markdown field uses the same extended syntax as write_document_markdown — see get_hero_writing_guide. A block you replace keeps its placeholders, terms and references only if your markdown carries them: read_document_text shows each as the markup to copy ({{placeholder:ID}}, {{term:Word}}, {{clauseRef:ID}}). Cross-references in the markdown you supply (“Section 2”) are linked automatically; blocks you did not touch are left alone. Deleting a clause that other text points at is reported as brokenClauseReferences — those references now read “Not found” and need the pointing text fixed. Lines whose markup could not be read come back as unparsedSyntax; fix those with patch_document. Comments stay on their text; one whose text the edit removed comes back in detachedComments: tell the user. Otherwise the result confirms the write: do not read the document back to check it.
Parameters
string
required
ID of the document to patch.
array<object>
required
Array of patch operations to apply in order.