Skip to content

Add pretext to String section #1084

@agiblox

Description

@agiblox

Hi! I'd like to suggest adding pretext to the String section.

What it does: Pretext is a 15 KB zero-dependency TypeScript library that measures multi-line text height ~500x faster than DOM-based methods. It uses Canvas measureText + pure arithmetic — no DOM reflows needed.

Why it fits: It solves a core text/string measurement problem that every browser-side JS developer faces. It's framework-agnostic (works with React, Vue, Svelte, Canvas, SVG, Node.js).

Stats:

  • 29,500+ GitHub stars (earned within days of release)
    • Author: Cheng Lou (former React core team, Midjourni)
      • Zero dependencies, 15 KB
        • MIT licensed
          Suggested entry:
- [pretext](https://github.com/chenglou/pretext) - Measures multi-line text height 500x faster than DOM, using Canvas measureText with zero reflows.
- ```
**Demo & docs:** [pretext.cool](https://pretext.cool)

Happy to open a PR if preferred!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions