Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] hyphenation in CSS #22

Open
Jocs opened this issue May 8, 2024 · 2 comments
Open

[Feature] hyphenation in CSS #22

Jocs opened this issue May 8, 2024 · 2 comments

Comments

@Jocs
Copy link
Contributor

Jocs commented May 8, 2024

I tested it on the demo site, and it doesn't seem to support hyphenation at the moment? Is there any planned support for the future?

How to turn on automatic hyphenation?

<html lang="en">
hyphens: auto;

And other CSS properties to control hyphenation. like:

hyphenate-limit-chars: 6 3 2;
hyphenate-limit-lines: 2;
hyphenate-limit-last: always;
hyphenate-limit-zone: 8%

Has no hyphenation:
截屏2024-05-08 11 00 39

Has hyphenation and set hyphens to auto:
截屏2024-05-08 11 00 31

@chearon
Copy link
Owner

chearon commented May 18, 2024

Soft hyphens (&shy;) are supported, so some of the work has been done, but automatic hyphenation will take building a string trie (or something similar) from a dictionary. I was dreading doing that for each language, but we could start with just English. There are also ML-based approaches that are pretty accurate and might have a lower file size, but that would be a lot more for me to learn at least.

@pixelspark
Copy link

In the mean time you could use hypher to hyphenate text (it inserts &shy;) before rendering. It works more or less okay and supports different languages.

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

No branches or pull requests

3 participants