redoc_diff() produces a diff object comparing the current contents of a Word document originally generated by redoc() to the original R markdown file used to create it.

redoc_diff(docx, target = "original", current = "current",
  track_changes = "comments_only", block_missing = "comment",
  inline_missing = "omit", wrap = getOption("redoc.wrap", 80),
  mode = "sidebyside", context = "auto", tar.banner = NULL,
  cur.banner = NULL, ...)

Arguments

docx

Path to an MS Word .docx file originally generated with redoc() and since edited.

target, current

Which versions of the document to compare. One of "original", "roundtrip", or "current".

track_changes, block_missing, inline_missing

Arguments passed to dedoc() to determine how to handle edits in the Word document.

wrap

Width to wrap text lines when converting from docx to markdown. If NULL, no wrapping. Set the default with "redoc.wrap" in options().

mode, context, tar.banner, cur.banner, ...

Arguments passed to diffobj::diffFile() to customize printing of the diff.

Value

A Diff object, which will be displayed in the RStudio Viewer, a browser, or the console, depending on the context.

Details

When an .docx file is created with redoc(), it internally stores the original R Markdown file as well as a version that is round-tripped to .docx and back. redoc_diff() de-renders the current .docx to R Markdown (with dedoc()) and compares against these versions.