feat(converter): add placeholders for unsupported content#84
Merged
Conversation
Add configurable placeholder rendering for content types that cannot be fully converted to HTML. When enabled, unsupported content displays as styled placeholder spans instead of being silently dropped. Supported content types: - WMF/EMF images: [WMF IMAGE], [EMF IMAGE] - SVG images: [SVG IMAGE] - Math equations (OMML): [MATH] - Form fields: [CHECKBOX], [TEXT INPUT], [DROPDOWN] - Ruby annotations: shows base text Settings: - RenderUnsupportedContentPlaceholders (default: false) - UnsupportedContentCssClassPrefix (default: "unsupported-") - IncludeUnsupportedContentMetadata (default: true) Placeholders include CSS styling (color-coded by type) and data attributes for metadata (content-type, element-name, title).
The HC028-HC032 tests were failing because they mixed SDK DOM and XLinq approaches without properly saving the DOM objects. Added stylesPart.Styles.Save() and settingsPart.Settings.Save() to serialize the parts before ConvertToHtml reads them.
Update TypeScript interface and worker to include the new renderUnsupportedContentPlaceholders parameter in the ConvertDocxToHtmlComplete function signature.
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.
Summary
Adds configurable placeholder rendering for content types that cannot be fully converted to HTML. When enabled via
RenderUnsupportedContentPlaceholders = true, unsupported content displays as styled placeholder spans instead of being silently dropped.Supported content types:
[WMF IMAGE],[EMF IMAGE][SVG IMAGE][MATH][CHECKBOX],[TEXT INPUT],[DROPDOWN]New settings:
RenderUnsupportedContentPlaceholders(default:falsefor backward compatibility)UnsupportedContentCssClassPrefix(default:"unsupported-")IncludeUnsupportedContentMetadata(default:true)Placeholder HTML structure:
Placeholders are color-coded by type (images=green, math=blue, forms=gray, ruby=light blue).
Test plan
dotnet testto verify new placeholder tests passrenderUnsupportedContentPlaceholdersoption correctly