Skip to content

Add ability to set wordWrap: break-word to always wrap newlines at arbitrary break points #125

@jennifer-shehane

Description

@jennifer-shehane

I essentially want the same functionality as css' overflow-wrap: break-word;

Note wordWrap: true does nothing here because there are no \n chars in my string.

My current table code:

const Table = require('cli-table3')

let table = new Table({
  'colWidths': [3, 36],
})

table.push([
  '✔',
  'stdout_specfile_display_spec_with_a_really_long_name_that_never_has_a_line_break_or_new_line.js',
])


console.log(table.toString())

Console output

Screen Shot 2019-09-13 at 5 45 16 PM

I want to pass some option like: wordWrap: 'break-word to the TableOptions and/or CellOptions so that I get this output from the code above

WHAT I WANT OUTPUT

Screen Shot 2019-09-13 at 5 48 49 PM

Can I do this myself? Yes. Is it a PITA? Yes. 😞

Finding the points to insert newlines would be more convenient from within this library since it already is calculating how to wrapWords and knows the width of the columns/rows already.

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