Skip to content

feat: add comment rendering support to HTML converter#14

Merged
JSv4 merged 7 commits intomainfrom
feature/html-comment-support
Nov 29, 2025
Merged

feat: add comment rendering support to HTML converter#14
JSv4 merged 7 commits intomainfrom
feature/html-comment-support

Conversation

@JSv4
Copy link
Copy Markdown
Owner

@JSv4 JSv4 commented Nov 29, 2025

Summary

  • Add full support for rendering Word document comments in HTML output with three rendering modes
  • Add CommentRenderMode enum: EndnoteStyle (default), Inline, and Margin
  • Add new settings: RenderComments, CommentRenderMode, CommentCssClassPrefix, IncludeCommentMetadata
  • Update WASM/npm wrapper with ConvertDocxToHtmlAdvanced method and TypeScript types

Test plan

  • Run all tests: 995 passed, 0 failed, 1 skipped
  • HC014: Comment CSS generated when enabled
  • HC015: Comment CSS not generated when disabled
  • HC016: Full comment content with metadata
  • HC017: Inline mode (tooltips)
  • HC018: Multiple comments in document
  • HC019: Custom CSS prefix
  • WASM builds successfully
  • TypeScript compiles without errors

JSv4 added 7 commits November 28, 2025 23:59
Add full support for rendering Word document comments in HTML output:

- CommentRenderMode enum with three modes:
  - EndnoteStyle: Comments at end with bidirectional links (default)
  - Inline: Comments as tooltips with data attributes
  - Margin: CSS-positioned margin comments

- New WmlToHtmlConverterSettings properties:
  - RenderComments: Enable/disable comment rendering
  - CommentRenderMode: Select rendering mode
  - CommentCssClassPrefix: Customize CSS class names
  - IncludeCommentMetadata: Include author/date in output

- Implementation details:
  - CommentInfo and CommentTracker helper classes
  - Handle commentRangeStart/End/Reference elements
  - Comment highlighting spans with configurable CSS
  - Full metadata support (author, date, initials)

- WASM/npm updates:
  - ConvertDocxToHtmlAdvanced method with comment parameters
  - TypeScript CommentRenderMode enum and ConversionOptions

- Tests: 6 new tests for comment rendering (HC014-HC019)
- Remove ConvertDocxToHtmlAdvanced, keep single ConvertDocxToHtmlWithOptions
- Add commentRenderMode parameter: -1=disabled, 0=EndnoteStyle, 1=Inline, 2=Margin
- Add CommentRenderMode.Disabled (-1) to TypeScript enum
- Simplify ConversionOptions by removing redundant renderComments boolean
- Simplify index.ts convertDocxToHtml function
Copy link
Copy Markdown
Owner Author

@JSv4 JSv4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@JSv4 JSv4 merged commit 6126a54 into main Nov 29, 2025
4 checks passed
JSv4 added a commit that referenced this pull request Dec 21, 2025
…onts

- Add FontClassifier helper to classify unknown fonts by name patterns
  - "sans" pattern → sans-serif fallback
  - "mono", "code", "courier" patterns → monospace fallback
  - Other fonts default to serif
- Add CJK font fallback chains for East Asian text:
  - Japanese (ja-JP): Noto Serif CJK JP, Yu Mincho, MS Mincho, etc.
  - Simplified Chinese (zh-hans): Noto Serif CJK SC, Microsoft YaHei, SimSun, etc.
  - Traditional Chinese (zh-hant): Noto Serif CJK TC, Microsoft JhengHei, PMingLiU, etc.
  - Korean (ko): Noto Serif CJK KR, Malgun Gothic, Batang, etc.
- Fix Courier New and Lucida Console to include monospace fallback
- Update CreateFontCssProperty to accept language context

Addresses converter gaps #13 (Limited Font Fallback) and #14 (No CJK Font-Family Fallback Chain)
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