Skip to content

feat: layout 모드 통합 — HtmlOptions.layout + 레이아웃 테스트#173

Merged
ohah merged 1 commit intomainfrom
feat/doc-html-layout-integration
Mar 18, 2026
Merged

feat: layout 모드 통합 — HtmlOptions.layout + 레이아웃 테스트#173
ohah merged 1 commit intomainfrom
feat/doc-html-layout-integration

Conversation

@ohah
Copy link
Copy Markdown
Owner

@ohah ohah commented Mar 18, 2026

Summary

  • HtmlOptions.layout: bool — pixel-accurate 레이아웃 모드 스위치
  • napi ToHtmlOptions.layout: Option<bool> — Node.js에서 { layout: true } 사용 가능
  • HWP + HWPX 모두 layout: true로 동일한 레이아웃 HTML 생성 가능

사용법

// Node.js — pixel-accurate 레이아웃
const html = toHtml(data, { layout: true });

// Node.js — 시맨틱 HTML (기본값)
const html = toHtml(data);
// Rust — pixel-accurate 레이아웃
let opts = HtmlOptions { layout: true, ..Default::default() };
document.to_html(&opts);

Phase 0~7 완료 요약

Phase 모듈 내용
0 convert/section, hints PageDef convert + LineSegmentFlags 디코더
1 styles noori_style.css 호환 CSS (50+ 클래스 + cs/ps)
2 flat_text, layout_text, layout_line_segment Run→flat 어댑터 + hrt span + hls div
3 layout_page hpa > hcD > hcI 페이지 구조
4 layout_pagination 페이지 나누기 (explicit/reset/overflow)
5 layout_table 표 htb > htG > hce 구조
6 layout_image 이미지 hsR + 텍스트 박스 hsT
7 mod.rs 머리글/꼬리글 수집 + render_page 전달
통합 이 PR HtmlOptions.layout + napi + 테스트

Test plan

  • cargo test — 전체 workspace 0 FAILED
  • test_layout_mode_produces_hpa — HWP layout 출력 검증
  • test_layout_mode_hwpx — HWPX layout 출력 검증

🤖 Generated with Claude Code

- HtmlOptions에 layout: bool 필드 추가
- HwpDocument::to_html()에서 layout 옵션 전달
- napi ToHtmlOptions에 layout: Option<bool> 추가
- convertToHtml(), hwpxToHtml()에서 layout 옵션 전달
- 레이아웃 모드 통합 테스트 2개 (HWP hpa/hls 검증, HWPX hpa 검증)

사용법:
  // Node.js
  const html = toHtml(data, { layout: true });
  // Rust
  let opts = HtmlOptions { layout: true, ..Default::default() };
  document.to_html(&opts);

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ohah ohah added the enhancement New feature or request label Mar 18, 2026
@ohah ohah self-assigned this Mar 18, 2026
@ohah ohah merged commit b3018ad into main Mar 18, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant