One-click install
npx skills add https://github.com/OpenCoven/coven-cave --skill pretext-opencoven
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pretext
Source: https://github.com/OpenCoven/coven-cave/tree/main/marketplace/plugins/pretext/skills/pretext
Command: npx skills add https://github.com/OpenCoven/coven-cave --skill pretext-opencoven

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill provides an efficient method to measure and lay out text without triggering DOM reflow, which is crucial for performance in web applications.

Core Features & Use Cases

  • Text Measurement: Measures text layout without interacting with the DOM.
  • Line Count and Height: Calculates line count and height for virtualized lists, sticky headers, and autosize rows.
  • Layout Shift Prevention: Ensures space reservation for late-loading text, preventing layout shifts.
  • Browser-Free Checks: Validates label overflow without a headless browser.
  • Manual Line Layout: Offers manual line layout for complex scenarios like text flowing around floats.
  • Rich Inline Flow: Handles inline chips, mentions, and code-spans.

Quick Start

Use the pretext skill to prepare and layout text with a given font and max width: pretext prepare 'Text to measure' '16px Arial' | pretext layout --max-width 100.

Frequently Asked Questions about pretext

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I measure text layout without causing DOM reflow in web applications?

Measuring text layout without DOM reflow requires using Intl.Segmenter and Canvas 2D. This technique calculates text dimensions independently of the browser DOM to prevent performance degradation.

How do I calculate line count and height for virtualized lists accurately?

You can calculate line count and height for virtualized lists by applying manual text layout techniques. This ensures accurate rendering measurements for sticky headers and autosize rows without triggering browser reflows.

How to prevent layout shifts when loading late-loading text dynamically?

To prevent layout shifts for late-loading text, you must reserve space accurately beforehand. This text measurement method calculates the required dimensions without DOM interaction, allowing you to allocate space before the text renders.

Do I need Intl.Segmenter and Canvas 2D to perform manual text layout?

Yes, performing manual text layout and measuring text without DOM reflow requires Intl.Segmenter and Canvas 2D. These browser APIs provide the necessary text segmentation and rendering context for accurate calculations.

Can I validate label overflow without using a headless browser?

You can validate label overflow without a headless browser by using this manual text measurement approach. It calculates text dimensions directly to check if labels exceed their boundaries without rendering them in a DOM.

What is the best way to handle rich inline flow with chips and mentions during text layout?

The best way to handle rich inline flow with chips, mentions, and code-spans is using manual text layout. This technique measures complex inline elements without DOM reflow to maintain performance optimization.