Adeu icon

Adeu

Operate on Microsoft Word (.docx) files: extract LLM-friendly Markdown with CriticMarkup, navigate large documents via a structural outline, apply tracked changes and comments, generate sub-word diffs or one-step redline comparisons, and sanitize/finalize documents. Seven operations on the Document resource: (1) Extract Markdown — project a .docx into Markdown plus a Semantic Appendix (or a Fields Content Controls ledger in mode='fields'); toggle Clean View to simulate Accept All; pass an optional Page number or 'N-M' page range to fetch a slice of a large document. (2) Extract Outline — return a token-cheap structural map (headings with level, page number, end_page, paragraph style, has_table, footnote IDs) plus total_pages. Pair with Extract Markdown to navigate large documents. (3) Apply Edits — apply a JSON array of DocumentChange objects sequentially as native Word tracked changes (or manual strikethrough/underline formatting when Markup Mode is 'manual'); modify edits support match_mode ('strict'|'first'|'all'), regex (boolean), Markdown headings/bold/italic/'\n\n' splits/pipe tables, `{#cell:<id>}` empty-cell anchors, and single or multi-author comments; set_field fills content controls by CC:<N>, tag, or alias. (4) Apply Text Revision — hand back the COMPLETE revised clean text of the document and let the engine diff it against the clean view and write the tracked changes; it refuses CriticMarkup and partial-page text, and fails without returning a document when the applied result's clean text does not match the text supplied. (5) Generate Diff — produce a @@ Word Patch @@ sub-word diff, unified diff, structured DocumentChange JSON array, or a one-step redlined .docx comparison (`diffFormat='redlineDocx'`) between two .docx files. (6) Finalize Document — strip metadata, optionally accept all pending markup, and optionally lock the file read-only. (7) Hydrate Tool Output — re-attach a redlined .docx that Apply Edits, Apply Text Revision, or Generate Diff (`redlineDocx`) stashed while running as an AI Agent tool; place it on the main line downstream of the Agent, because n8n's tool wrapper strips binaries from tool output. DocumentChange schema (used by Apply Edits): each object has a 'type' field discriminator, and changes in a batch evaluate SEQUENTIALLY against the state produced by prior changes. type='modify' requires target_text (string — plain text resolves across hyperlinks, cross-references, and bookmarks; empty table cells emit `{#cell:<id>}`) and new_text (string — supports '#'–'######' headings, '**bold**', '_italic_', '\n\n' paragraph splits, and Markdown pipe tables `| H1 | H2 |\n|---|---|\n| A | B |`; omit new_text with a comment to annotate without changing text; empty string deletes); optional comment (string or `[{text, author?}]`); optional match_mode ('strict'|'first'|'all', default 'strict'); optional regex (boolean, default false — when true, target_text is an ES2022 RegExp pattern with optional inline flags like `(?i)`, and new_text may reference $1, $2 capture groups). type='set_field' requires field (string like 'CC:3', tag, or alias from Extract Markdown mode='fields') and value (string — checkboxes take true/false, dates YYYY-MM-DD, dropdowns a listed option); optional match_mode and comment. type='accept' or type='reject' requires target_id (string like 'Chg:12' from the Markdown projection); optional part (e.g. 'word/header1.xml' when the same id exists in several parts); optional comment. type='reply' requires target_id (string like 'Com:45') and text (string). type='insert_row' requires target_text (string), position ('above' or 'below'), and cells (array of strings). type='delete_row' requires target_text (string). Never wrap new_text in CriticMarkup tags like {++ ++} or {-- --}; the engine applies tracking automatically. Never target text already wrapped in another author's pending tracked change; accept or reject their change first by target_id. Binary handling for AI Agents: this tool cannot receive .docx files through JSON arguments because JSON cannot carry binary data. To process a document, set 'Document Source' to 'From Another Node' and 'Source Node Name' to the exact name of the workflow node that produced the .docx binary (typically the trigger node, e.g. 'Gmail Trigger', 'When clicking Test workflow', or an HTTP Request node configured to download a file). Node names are case-sensitive and must match the canvas label exactly. For the Generate Diff operation, set both 'Original Source Node Name' and 'Modified Source Node Name' independently.

Document → Hydrate Tool Output

AI-generated

Summary

Reads stashed binary metadata from workflow static data, retrieves the original document buffer, and attaches it to the output item under the configured binary property. Can also return a suggested output path and optionally clear the stash after a successful read.

Inputs

  • Static Data Key (required) — Workflow static data key containing the stashed binary metadata; defaults to adeu_last_redlined.
  • Output Binary Property (required) — Name for the hydrated .docx binary on the output item; defaults to data.
  • On Missing — When no stash entry is found, either emit an item with json.hydrated=false and no binary, or throw an error. Defaults to Emit Empty.
  • Clear After Read — Whether to delete the stash entry after successful hydration; defaults to true.
  • Output Path Template — Optional path template returned as json.outputPath. Supports {baseName}, {timestamp}, {fileName}, and {ext} placeholders.

Output shape

A single item containing the hydrated document as binary and JSON metadata.

When the stash is missing and On Missing is Emit Empty, returns an item with json.hydrated=false and no binary. When a path template is set, its computed path is included as json.outputPath.

Links

Discussion