docx2html: add --track-changes and story rendering flags#269
Merged
Conversation
The docx2html CLI always accepted revisions before converting, so a redline document rendered as if every change had been applied — there was no way to preview a redline in a browser. Add flags mapping straight onto the existing WmlToHtmlConverterSettings: --track-changes render revisions as ins/del/move markup --no-render-moves lower move markup to plain ins/del --render-comments render document comments --render-footnotes render footnotes and endnotes --render-headers-footers render document headers and footers Defaults are unchanged (all off, moves on), so existing invocations behave identically. This is the preview half of the docx-redlines GitHub Action (JSv4/Python-Redlines#12): the action redlines changed .docx files with the redline CLI and uses docx2html --track-changes to publish browser-viewable previews. Verified: redline over WC001-Digits fixtures reports 4 revisions; converting that output without the flag yields 0 ins/del elements (revisions accepted, prior behavior), with --track-changes yields 4.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
docx2htmlCLI always accepted revisions before converting (theRenderTrackedChanges = falsedefault), so a redline document rendered as if every change had already been applied — there was no way to preview a redline in a browser from the command line, even thoughWmlToHtmlConverterhas supported it for a long time.This adds CLI flags mapping straight onto the existing
WmlToHtmlConverterSettings(no library changes):--track-changesRenderTrackedChanges = true— render revisions asins/del/move markup--no-render-movesRenderMoveOperations = false— lower move markup to plain ins/del--render-commentsRenderComments = true--render-footnotesRenderFootnotesAndEndnotes = true--render-headers-footersRenderHeadersAndFooters = trueDefaults are unchanged (all off, moves on), so existing invocations behave identically. Tool version const bumped to 1.1.0; CHANGELOG entry under
[Unreleased](an### Addedentry, so the next release is a minor per the release process).Motivation
This is the preview half of the docx-redlines GitHub Action requested in JSv4/Python-Redlines#12 and implemented in JSv4/Python-Redlines#27: the action redlines the
.docxfiles a PR changes using theredlineCLI, then runsdocx2html --track-changesover each redline to publish browser-viewable previews alongside the.docxartifacts. The action'shtml-preview: automode probesdocx2html --helpfor--track-changes, so it lights up automatically once this lands in a NuGet release of theDocx2Htmltool.Verification
Built with the .NET 10 SDK and exercised over
TestFiles/WC/WC001-Digits{,-Mod}.docx:redlinereports 4 revisions on the pair.ins/delelements (revisions accepted — prior behavior, unchanged).--track-changes: 4ins/delelements with the converter's tracked-changes CSS.The flags are thin passthroughs to converter settings already covered by
HtmlConverterTests; the CLI tools have no test project, matching the existing pattern fortools/.Generated by Claude Code