Skip to content

[Feature] hyphenation in CSS #22

Open

Description

@Jocs

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

Activity

  1. chearon commented on May 18, 2024

    @chearon
    Owner

    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.

  2. pixelspark commented on May 18, 2024

    @pixelspark

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions