Skip to content

Hyphenation on line-broken text#3193

Open
KaramTNC wants to merge 5 commits into
amruthpillai:mainfrom
KaramTNC:main
Open

Hyphenation on line-broken text#3193
KaramTNC wants to merge 5 commits into
amruthpillai:mainfrom
KaramTNC:main

Conversation

@KaramTNC

@KaramTNC KaramTNC commented Jun 30, 2026

Copy link
Copy Markdown

Long words were not wrapping properly on cells and lacked automatic hyphenation.

For now it only involves english and danish hyphenation as those are my main languages. You are welcome to add your languages or modify for a more general-purpose hyphenation across all languages

A section element title being hyphenated due to its length
image

A section element text being hyphenated due to the cell size
image

Summary by CodeRabbit

  • New Features
    • Improved locale-aware hyphenation for PDF text to enhance line wrapping for long Latin words (including Danish and US English).
  • Bug Fixes
    • Resolved hyphenation behavior when line breaking is enabled: non-CJK text now wraps using hyphenated chunks instead of staying unbroken.
    • Danish hyphenation is applied only for the Danish locale, avoiding incorrect English results.
  • Tests
    • Added hyphenation test coverage for Danish and US English scenarios.
  • Chores
    • Added a Docker restart policy to keep the server running unless explicitly stopped.

KaramTNC added 3 commits June 30, 2026 13:51
Compose file was missing a restart policy for reactive-resume service, which was causing the service to not restart during docker restarts
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c5775e0f-358b-4659-99e8-8526121b9243

📥 Commits

Reviewing files that changed from the base of the PR and between d885cf4 and 3eeda0c.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • apps/server/package.json
  • packages/pdf/src/hooks/use-register-fonts.ts
  • packages/pdf/src/hyphen.d.ts
✅ Files skipped from review due to trivial changes (1)
  • apps/server/package.json
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/pdf/src/hyphen.d.ts
  • packages/pdf/src/hooks/use-register-fonts.ts

📝 Walkthrough

Walkthrough

Adds locale-aware Latin hyphenation to the PDF rendering pipeline using the hyphen library, with Danish and US English module support, callback changes, and tests. Also adds restart: unless-stopped to the Docker Compose service.

Changes

Locale-aware Latin Hyphenation

Layer / File(s) Summary
TypeScript declarations and dependency
packages/pdf/package.json, packages/pdf/src/hyphen.d.ts
Adds hyphen@1.14.1 and declares typed module entries for hyphen/da and hyphen/en-us, each exposing hyphenateSync.
Hyphenation helpers and callback integration
packages/pdf/src/hooks/use-register-fonts.ts
Imports locale hyphenators, defines the internal hyphenation helpers and locale map, and routes non-CJK words through hyphenateLatinWord(word, locale).
Hyphenation callback tests
packages/pdf/src/hooks/use-register-fonts.test.ts
Adds tests for Danish hyphenation on da-DK and non-Danish segmentation on en-US.

Docker Restart Policy

Layer / File(s) Summary
Docker restart policy
compose.yml
Adds restart: unless-stopped to the reactive_resume service.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding hyphenation for line-broken text.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/pdf/src/hyphen.d.ts`:
- Around line 1-15: The module declarations in hyphen.d.ts should match the
published locale import subpaths, not the internal index.js paths. Update the
declarations for the hyphenator module aliases used by the PDF package to target
hyphen/da and hyphen/en-us directly, and keep the default export shape the same
so TypeScript resolves the same imports exposed by the package exports map.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ce108460-9bc0-4fc3-bb35-8edf9aad1c56

📥 Commits

Reviewing files that changed from the base of the PR and between d3735eb and 259b72d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (5)
  • compose.yml
  • packages/pdf/package.json
  • packages/pdf/src/hooks/use-register-fonts.test.ts
  • packages/pdf/src/hooks/use-register-fonts.ts
  • packages/pdf/src/hyphen.d.ts

Comment thread packages/pdf/src/hyphen.d.ts
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