CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-wrap-ansi

tessl install tessl/npm-wrap-ansi@9.0.0

Wordwrap a string with ANSI escape codes

Agent Success

Agent success rate when using this tile

100%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.04x

Baseline

Agent success rate without this tile

96%

task.mdevals/scenario-10/

Styled Terminal Link Wrapper

A utility for wrapping text containing styled hyperlinks to fit within terminal column constraints.

Capabilities

Wraps text with styled hyperlinks

  • Given text containing a clickable hyperlink with colored text inside it, wrap the text to 20 columns and verify the output maintains both the hyperlink and color formatting across line breaks @test
  • Given text with a hyperlink containing bold styled text, wrap to 15 columns and verify bold styling is preserved when the link spans multiple lines @test

Handles complex nested formatting

  • Given text with a hyperlink containing multiple different ANSI color codes (e.g., red and blue text within the same link), wrap to 25 columns and verify all color codes are correctly maintained @test
  • Given a hyperlink with nested styling (both color and text decoration like underline), wrap to 18 columns and ensure both style types persist across wrapped lines @test

Implementation

@generates

API

/**
 * Wraps text containing styled hyperlinks to fit within a specified column width.
 * Preserves ANSI escape codes for both hyperlinks and text styling (colors, bold, etc.)
 * across line breaks.
 *
 * @param {string} text - The text to wrap, may contain ANSI hyperlinks and style codes
 * @param {number} columns - The maximum column width for wrapping
 * @returns {string} The wrapped text with preserved formatting
 */
function wrapStyledLinks(text, columns) {
  // IMPLEMENTATION HERE
}

module.exports = { wrapStyledLinks };

Dependencies { .dependencies }

wrap-ansi { .dependency }

Provides text wrapping with ANSI escape code preservation, including support for hyperlinks and nested styling.

@satisfied-by

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/wrap-ansi@9.0.x
tile.json