Skip to content

feat: implement html-to-word-swift converter #50

@PsychQuantClaw

Description

@PsychQuantClaw

Summary

Restore and finish html-to-word-swift as a proper Layer 3 converter in macdoc.

The current main branch only carries the package manifest / README / CLI wiring from the earlier merge, but the tracked converter source and tests are missing. This follow-up issue lands the actual converter implementation.

Conversion Requirements

  • Input: .html
  • Output: Word .docx (plus streamed OOXML document XML for DocumentConverter)
  • Architecture: direct HTML → Word path using OOXML writer strategy
  • Protocol: implement DocumentConverter with StreamingOutput

Layer 1 / Core Dependencies

  • SwiftSoup for HTML parsing
  • ooxml-swift for DOCX generation
  • common-converter-swift (DocumentConverter, StreamingOutput, ConversionOptions)

Implementation Notes

  • Map headings, paragraphs, lists, tables, hyperlinks, blockquotes, and preformatted blocks into WordDocument
  • Provide convertToFile for .docx output and streaming convert for document XML
  • Keep package independent under packages/html-to-word-swift/
  • Ensure CLI command macdoc html-to-word works against the restored package source

Test Strategy

  • Package-level tests for XML/docx generation, metadata, inline formatting, lists, tables, hyperlinks, and code/blockquote handling
  • swift test inside packages/html-to-word-swift

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions