Skip to content

feat(converter): add placeholders for unsupported content#84

Merged
JSv4 merged 3 commits intomainfrom
feature/unsupported-content-placeholders
Dec 20, 2025
Merged

feat(converter): add placeholders for unsupported content#84
JSv4 merged 3 commits intomainfrom
feature/unsupported-content-placeholders

Conversation

@JSv4
Copy link
Copy Markdown
Owner

@JSv4 JSv4 commented Dec 20, 2025

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/EMF images: Legacy Windows Metafile formats → [WMF IMAGE], [EMF IMAGE]
  • SVG images: Not yet supported → [SVG IMAGE]
  • Math equations (OMML): Office Math Markup → [MATH]
  • Form fields: Checkboxes, text inputs, dropdowns → [CHECKBOX], [TEXT INPUT], [DROPDOWN]
  • Ruby annotations: East Asian text annotations → shows base text

New settings:

  • RenderUnsupportedContentPlaceholders (default: false for backward compatibility)
  • UnsupportedContentCssClassPrefix (default: "unsupported-")
  • IncludeUnsupportedContentMetadata (default: true)

Placeholder HTML structure:

<span class="unsupported-placeholder unsupported-math"
      data-content-type="MathEquation"
      data-element-name="oMath"
      title="Math equation (Office Math Markup) - not supported in HTML output">
  [MATH]
</span>

Placeholders are color-coded by type (images=green, math=blue, forms=gray, ruby=light blue).

Test plan

  • Run dotnet test to verify new placeholder tests pass
  • Verify backward compatibility - default settings should not show placeholders
  • Test with documents containing math equations, form fields
  • Verify npm wrapper passes renderUnsupportedContentPlaceholders option correctly

JSv4 added 3 commits December 20, 2025 12:15
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.
@JSv4 JSv4 merged commit 6e2ea1a into main Dec 20, 2025
6 checks passed
@JSv4 JSv4 deleted the feature/unsupported-content-placeholders branch December 20, 2025 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant