markdown-table
Advanced tools
Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "markdown-table", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Markdown/ASCII tables", | ||
@@ -15,4 +15,3 @@ "license": "MIT", | ||
], | ||
"dependencies": {}, | ||
"repository": "https://github.com/wooorm/markdown-table", | ||
"repository": "wooorm/markdown-table", | ||
"bugs": "https://github.com/wooorm/markdown-table/issues", | ||
@@ -23,20 +22,19 @@ "author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)", | ||
], | ||
"engines": { | ||
"node": ">=0.11.0" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"browserify": "^14.0.0", | ||
"chalk": "^1.1.3", | ||
"chalk": "^2.0.0", | ||
"esmangle": "^1.0.0", | ||
"nyc": "^10.0.0", | ||
"remark-cli": "^2.0.0", | ||
"remark-preset-wooorm": "^1.0.0", | ||
"nyc": "^11.0.0", | ||
"remark-cli": "^3.0.0", | ||
"remark-preset-wooorm": "^3.0.0", | ||
"strip-ansi": "^4.0.0", | ||
"tape": "^4.4.0", | ||
"xo": "^0.17.0" | ||
"xo": "^0.18.0" | ||
}, | ||
"scripts": { | ||
"build-md": "remark . --quiet --frail", | ||
"build-md": "remark . -qfo", | ||
"build-bundle": "browserify index.js -s markdownTable > markdown-table.js", | ||
@@ -58,2 +56,3 @@ "build-mangle": "esmangle markdown-table.js > markdown-table.min.js", | ||
"space": true, | ||
"esnext": false, | ||
"rules": { | ||
@@ -68,5 +67,6 @@ "complexity": "off", | ||
"remarkConfig": { | ||
"output": true, | ||
"presets": "wooorm" | ||
"plugins": [ | ||
"preset-wooorm" | ||
] | ||
} | ||
} |
@@ -15,11 +15,7 @@ # markdown-table [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] | ||
Dependencies: | ||
Normal usage (defaults to left-alignment): | ||
```javascript | ||
var table = require('markdown-table'); | ||
``` | ||
Normal usage (defaults to left-alignment): | ||
```javascript | ||
table([ | ||
@@ -34,3 +30,3 @@ ['Branch', 'Commit'], | ||
```txt | ||
```markdown | ||
| Branch | Commit | | ||
@@ -58,3 +54,3 @@ | ------- | ---------------- | | ||
```txt | ||
```markdown | ||
| Beep | No. | Boop | | ||
@@ -84,3 +80,3 @@ | :--- | :-----: | -----: | | ||
```txt | ||
```markdown | ||
| No. | | ||
@@ -100,32 +96,35 @@ | :---------: | | ||
###### `options` | ||
##### `options` | ||
The following options are available: | ||
###### `options.align` | ||
* `options.align` (`string` or `Array.<string>`) | ||
— One style for all columns, or styles for their respective | ||
columns. Each style is either `'l'` (left), `'r'` (right), `'c'` | ||
(centre), or `'.'` (dot). Other values are treated as `''`, which | ||
doesn’t place the colon but does left align. _Only the lowercased | ||
first character is used, so `Right` is fine_; | ||
* `options.delimiter` (`string`, default: `' | '`) | ||
— Value to insert between cells. Careful, setting this to a | ||
non-pipe breaks GitHub Flavoured Markdown; | ||
* `options.start` (`string`, default: `'| '`) | ||
— Value to insert at the beginning of every row. | ||
* `options.end` (`string`, default: `' |'`) | ||
— Value to insert at the end of every row. | ||
* `options.rule` (`boolean`, default: `true`) | ||
— Whether to display a rule between the header and the body of the | ||
table. Careful, will break GitHub Flavoured Markdown when `false`; | ||
* `options.stringLength` ([`Function`][length], default: | ||
`s => s.length`) | ||
— Method to detect the length of a cell (see below). | ||
* `options.pad` (`boolean`, default: `true`) | ||
— Whether to pad the markdown for table cells to make them the same | ||
width. Setting this to false will cause the table rows to | ||
remain staggered. | ||
One style for all columns, or styles for their respective columns (`string` or | ||
`Array.<string>`). Each style is either `'l'` (left), `'r'` (right), `'c'` | ||
(centre), or `'.'` (dot). Other values are treated as `''`, which doesn’t place | ||
the colon but does left align. _Only the lowercased first character is used, | ||
so `Right` is fine._ | ||
### `stringLength(cell)` | ||
###### `options.delimiter` | ||
Value to insert between cells (`string`, default: `' | '`). Careful, setting | ||
this to a non-pipe breaks GitHub Flavoured Markdown. | ||
###### `options.start` | ||
Value to insert at the beginning of every row (`string`, default: `'| '`). | ||
###### `options.end` | ||
Value to insert at the end of every row (`string`, default: `' |'`). | ||
###### `options.rule` | ||
Whether to display a rule between the header and the body of the table | ||
(`boolean`, default: `true`). Careful, will break GitHub Flavoured Markdown | ||
when `false`. | ||
###### `options.stringLength` | ||
Method to detect the length of a cell (`Function`, default: `s => s.length`). | ||
ANSI-sequences mess up tables on terminals. To fix this, you have to | ||
@@ -136,9 +135,15 @@ pass in a `stringLength` option to detect the “visible” length of a | ||
```javascript | ||
var chalk = require('chalk'); | ||
var strip = require('strip-ansi'); | ||
function stringLength(cell) { | ||
return chalk.stripColor(cell).length; | ||
return strip(cell).length; | ||
} | ||
``` | ||
###### `options.pad` | ||
Whether to pad the markdown for table cells to make them the same width | ||
(`boolean`, default: `true`). Setting this to false will cause the table | ||
rows to remain staggered. | ||
## Inspiration | ||
@@ -171,4 +176,2 @@ | ||
[length]: #stringlengthcell | ||
[text-table]: https://github.com/substack/text-table |
171
11594
9