You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// By default, headers will be red, and borders will be greylettable=newTable({head: ['a','b']});table.push(['c','d']);
Basic Usage - disable colors - (used often in the examples and tests)
┌──────┬─────────────────────┬─────────────────────────┬─────────────────┐
│ Rel │ Change │ By │ When │
├──────┼─────────────────────┼─────────────────────────┼─────────────────┤
│ v0.1 │ Testing something … │ rauchg@gmail.com │ 7 minutes ago │
├──────┼─────────────────────┼─────────────────────────┼─────────────────┤
│ v0.1 │ Testing something … │ rauchg@gmail.com │ 8 minutes ago │
└──────┴─────────────────────┴─────────────────────────┴─────────────────┘
// For most of these examples, and most of the unit tests we disable colors.// It makes unit tests easier to write/understand, and allows these pages to// display the examples as text instead of screen shots.lettable=newTable({head: ['Rel','Change','By','When'],style: {head: [],//disable colors in header cellsborder: [],//disable colors for the border},colWidths: [6,21,25,17],//set the widths of each column (optional)});table.push(['v0.1','Testing something cool','rauchg@gmail.com','7 minutes ago'],['v0.1','Testing something cool','rauchg@gmail.com','8 minutes ago']);
Create vertical tables by adding objects a that specify key-value pairs
Set wordWrap to true to wrap text on word boundaries
┌───────┬─────────┬───────────────────┬──────────────┐
│ Hello │ I am │ Words that exceed │ Text is only │
│ how │ fine │ the colWidth will │ wrapped for │
│ are │ thanks! │ be truncated. │ fixed width │
│ you? │ Looooo… │ │ columns. │
└───────┴─────────┴───────────────────┴──────────────┘
lettable=newTable({style: {border: [],header: []},colWidths: [7,9],// Requires fixed column widthswordWrap: true,});table.push(['Hello how are you?','I am fine thanks! Looooooong',['Words that exceed','the colWidth will','be truncated.'].join('\n'),['Text is only','wrapped for','fixed width','columns.'].join('\n'),]);
Using wordWrap, set wrapOnWordBoundary to false to ignore word boundaries
┌───┬───┐
│ W │ T │
│ r │ e │
│ a │ x │
│ p │ t │
└───┴───┘
consttable=newTable({style: {border: [],header: []},colWidths: [3,3],// colWidths must all be greater than 2!!!!wordWrap: true,wrapOnWordBoundary: false,});table.push(['Wrap','Text']);
Supports hyperlinking cell content using the href option
┌───────────┬─────┬─────┐
│ Text Link │ Hel │ htt │
│ │ lo │ p:/ │
│ │ Lin │ /ex │
│ │ k │ amp │
│ │ │ le. │
│ │ │ com │
├───────────┴─────┴─────┤
│ http://example.com │
└───────────────────────┘
Note: Links are not displayed in documentation examples.