{"name":"markdown-table","version":"2.0.0","description":"Markdown tables","license":"MIT","keywords":["text","markdown","table","align","rows","tabular"],"repository":{"type":"git","url":"git+https://github.com/wooorm/markdown-table.git"},"bugs":{"url":"https://github.com/wooorm/markdown-table/issues"},"funding":{"type":"github","url":"https://github.com/sponsors/wooorm"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"dependencies":{"repeat-string":"^1.0.0"},"devDependencies":{"browserify":"^16.0.0","chalk":"^3.0.0","nyc":"^15.0.0","prettier":"^1.0.0","remark-cli":"^7.0.0","remark-preset-wooorm":"^6.0.0","strip-ansi":"^6.0.0","tape":"^4.0.0","tinyify":"^2.0.0","xo":"^0.25.0"},"scripts":{"format":"remark . -qfo && prettier --write \"**/*.js\" && xo --fix","build-bundle":"browserify . -s markdownTable -o markdown-table.js","build-mangle":"browserify . -s markdownTable -p tinyify -o markdown-table.min.js","build":"npm run build-bundle && npm run build-mangle","test-api":"node test","test-coverage":"nyc --reporter lcov tape test.js","test":"npm run format && npm run build && npm run test-coverage"},"remarkConfig":{"plugins":["preset-wooorm"]},"prettier":{"tabWidth":2,"useTabs":false,"singleQuote":true,"bracketSpacing":false,"semi":false,"trailingComma":"none"},"xo":{"prettier":true,"esnext":false,"rules":{"complexity":"off"},"ignores":["markdown-table.js"]},"nyc":{"check-coverage":true,"lines":100,"functions":100,"branches":100},"gitHead":"976ac8a55d5eb4b030691ee0f0d44f671191d5bc","homepage":"https://github.com/wooorm/markdown-table#readme","_id":"markdown-table@2.0.0","_nodeVersion":"13.0.1","_npmVersion":"6.13.6","dist":{"integrity":"sha512-Ezda85ToJUBhM6WGaG6veasyym+Tbs3cMAw/ZhOPqXiYsr0jgocBV3j3nx+4lk47plLlIqjwuTm/ywVI+zjJ/A==","shasum":"194a90ced26d31fe753d8b9434430214c011865b","tarball":"http://registry-npm.ywwl.com/markdown-table/download/markdown-table-2.0.0.tgz","fileCount":4,"unpackedSize":13622,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeKc5dCRA9TVsSAnZWagAAFZUP/1niyRL9kSMXMpxFJ+pe\nmOa2LnqDHP5sguMeQY5bRVKr2ZL2EEJp+DJQXCVBc34LKdx2F3jXRciRc76b\n5h6qdn5XgmM6RgMAqSrutQwauo9eQ2fLYlWf/jbuxWTeNF0tBsNH9sf0kEJG\nJsbW8afn/llRyJ68DimQEzOvpiVWZ/jFN/aSvXU+7gkB/RZsz48yt7oSvVxZ\nhlIAuvZrFBRpAXbLlBcI+a+JS18D5yGluTNV3n3cVEwANEEEJxOQnoMcdEBw\nwrIHAPeZmBsnf+AaOpaiOk0khqKk3fM4wBs5hR6Ue+1ioIaewS6f1PdyUkV/\nQ5ZmDKFAb7ZUXiIEvIGsuqrNKZzkq3GgdaynNFCBHDwT/zYsOh1xDEG3fhPy\npyB4PnKjT4g143i9fClOJAqEpuXs/jqdwvCPpq1ncSifjnfwXD4RhCFFZcF/\nyZBTWRg+plp+rpv3zL2uxuBafV4ty8mmRkw2T8CpjwZOjedSCvZPkgIiwEGh\ndfSTX7WyNo0WM2qUFsvh9r9M4hPD3jcTmzmPnUG15hNU9ieWbD5bw3EqngFh\neACRxCh6ul1RaPKP6CJG9TfUw+m/vzludpIVJlsbEOrawZZo/uWpClVReZAH\n1emTdaDd12YItLq3jhoorW5OuIvptSop7PMVdjtglU1SCpqQs6j5dZUNqaq0\n8Aqu\r\n=iIjF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQClQlO2fyEEUSg21atgoN9G2Yf9kGg8kUPaAnwcC32GlgIgKyYDTngElwR50XrjNcRG9Bi0wU1QEFwf09TmxQTCzEk="}],"size":4877,"noattachment":false,"key":"/markdown-table/-/markdown-table-2.0.0.tgz"},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"}],"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/markdown-table_2.0.0_1579798108822_0.023071110036176457"},"_hasShrinkwrap":false,"readme":"# markdown-table\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n\nGenerate a markdown ([GFM][]) table.\n\n## Contents\n\n*   [What is this?](#what-is-this)\n*   [When should I use this?](#when-should-i-use-this)\n*   [Install](#install)\n*   [Use](#use)\n*   [API](#api)\n    *   [`markdownTable(table[, options])`](#markdowntabletable-options)\n*   [Types](#types)\n*   [Compatibility](#compatibility)\n*   [Security](#security)\n*   [Inspiration](#inspiration)\n*   [Contribute](#contribute)\n*   [License](#license)\n\n## What is this?\n\nThis is a simple package that takes table data and generates a [GitHub flavored\nmarkdown (GFM)][gfm] table.\n\n## When should I use this?\n\nYou can use this package when you want to generate the source code of a GFM\ntable from some data.\n\nThis is a simple solution in that it doesn’t handle escapes or HTML or any of\nthat.\nFor a complete but heavier solution, build an AST and serialize it with\n[`mdast-util-to-markdown`][mdast-util-to-markdown] (with\n[`mdast-util-gfm`][mdast-util-gfm]).\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 14.14+, 16.0+), install with [npm][]:\n\n```sh\nnpm install markdown-table\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {markdownTable} from 'https://esm.sh/markdown-table@3'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import {markdownTable} from 'https://esm.sh/markdown-table@3?bundle'\n</script>\n```\n\n## Use\n\nTypical usage (defaults to align left):\n\n```js\nimport {markdownTable} from 'markdown-table'\n\nmarkdownTable([\n  ['Branch', 'Commit'],\n  ['main', '0123456789abcdef'],\n  ['staging', 'fedcba9876543210']\n])\n```\n\nYields:\n\n```markdown\n| Branch  | Commit           |\n| ------- | ---------------- |\n| main    | 0123456789abcdef |\n| staging | fedcba9876543210 |\n```\n\nWith align:\n\n```js\nmarkdownTable(\n  [\n    ['Beep', 'No.', 'Boop'],\n    ['beep', '1024', 'xyz'],\n    ['boop', '3388450', 'tuv'],\n    ['foo', '10106', 'qrstuv'],\n    ['bar', '45', 'lmno']\n  ],\n  {align: ['l', 'c', 'r']}\n)\n```\n\nYields:\n\n```markdown\n| Beep |   No.   |   Boop |\n| :--- | :-----: | -----: |\n| beep |   1024  |    xyz |\n| boop | 3388450 |    tuv |\n| foo  |  10106  | qrstuv |\n| bar  |    45   |   lmno |\n```\n\n## API\n\nThis package exports the identifier `markdownTable`.\nThere is no default export.\n\n### `markdownTable(table[, options])`\n\nGenerate a markdown table from table data (matrix of strings).\n\n##### `options`\n\nConfiguration (optional).\n\n###### `options.align`\n\nOne style for all columns, or styles for their respective columns (`string` or\n`Array<string>`).\nEach style is either `'l'` (left), `'r'` (right), or `'c'` (center).\nOther values are treated as `''`, which doesn’t place the colon in the alignment\nrow but does align left.\n*Only the lowercased first character is used, so `Right` is fine.*\n\n###### `options.padding`\n\nWhether to add a space of padding between delimiters and cells (`boolean`,\ndefault: `true`).\n\nWhen `true`, there is padding:\n\n```markdown\n| Alpha | B     |\n| ----- | ----- |\n| C     | Delta |\n```\n\nWhen `false`, there is no padding:\n\n```markdown\n|Alpha|B    |\n|-----|-----|\n|C    |Delta|\n```\n\n###### `options.delimiterStart`\n\nWhether to begin each row with the delimiter (`boolean`, default: `true`).\n\n> 👉 **Note**: please don’t use this: it could create fragile structures that\n> aren’t understandable to some markdown parsers.\n\nWhen `true`, there are starting delimiters:\n\n```markdown\n| Alpha | B     |\n| ----- | ----- |\n| C     | Delta |\n```\n\nWhen `false`, there are no starting delimiters:\n\n```markdown\nAlpha | B     |\n----- | ----- |\nC     | Delta |\n```\n\n###### `options.delimiterEnd`\n\nWhether to end each row with the delimiter (`boolean`, default: `true`).\n\n> 👉 **Note**: please don’t use this: it could create fragile structures that\n> aren’t understandable to some markdown parsers.\n\nWhen `true`, there are ending delimiters:\n\n```markdown\n| Alpha | B     |\n| ----- | ----- |\n| C     | Delta |\n```\n\nWhen `false`, there are no ending delimiters:\n\n```markdown\n| Alpha | B\n| ----- | -----\n| C     | Delta\n```\n\n###### `options.alignDelimiters`\n\nWhether to align the delimiters (`boolean`, default: `true`).\nBy default, they are aligned:\n\n```markdown\n| Alpha | B     |\n| ----- | ----- |\n| C     | Delta |\n```\n\nPass `false` to make them staggered:\n\n```markdown\n| Alpha | B |\n| - | - |\n| C | Delta |\n```\n\n###### `options.stringLength`\n\nFunction to detect the length of table cell content (`Function`, default:\n`s => s.length`).\nThis is used when aligning the delimiters (`|`) between table cells.\nFull-width characters and emoji mess up delimiter alignment when viewing the\nmarkdown source.\nTo fix this, you can pass this function, which receives the cell content and\nreturns its “visible” size.\nNote that what is and isn’t visible depends on where the text is displayed.\n\nWithout such a function, the following:\n\n```js\nmarkdownTable([\n  ['Alpha', 'Bravo'],\n  ['中文', 'Charlie'],\n  ['👩‍❤️‍👩', 'Delta']\n])\n```\n\nYields:\n\n```markdown\n| Alpha | Bravo |\n| - | - |\n| 中文 | Charlie |\n| 👩‍❤️‍👩 | Delta |\n```\n\nWith [`string-width`][string-width]:\n\n```js\nimport stringWidth from 'string-width'\n\nmarkdownTable(\n  [\n    ['Alpha', 'Bravo'],\n    ['中文', 'Charlie'],\n    ['👩‍❤️‍👩', 'Delta']\n  ],\n  {stringLength: stringWidth}\n)\n```\n\nYields:\n\n```markdown\n| Alpha | Bravo   |\n| ----- | ------- |\n| 中文  | Charlie |\n| 👩‍❤️‍👩    | Delta   |\n```\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional type `Options`.\n\n## Compatibility\n\nThis package is at least compatible with all maintained versions of Node.js.\nAs of now, that is Node.js 14.14+ and 16.0+.\nIt also works in Deno and modern browsers.\n\n## Security\n\nThis package is safe.\n\n## Inspiration\n\nThe original idea and basic implementation was inspired by James Halliday’s\n[`text-table`][text-table] library.\n\n## Contribute\n\nYes please!\nSee [How to Contribute to Open Source][contribute].\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n<!-- Definitions -->\n\n[build-badge]: https://github.com/wooorm/markdown-table/workflows/main/badge.svg\n\n[build]: https://github.com/wooorm/markdown-table/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/markdown-table.svg\n\n[coverage]: https://codecov.io/github/wooorm/markdown-table\n\n[downloads-badge]: https://img.shields.io/npm/dm/markdown-table.svg\n\n[downloads]: https://www.npmjs.com/package/markdown-table\n\n[size-badge]: https://img.shields.io/bundlephobia/minzip/markdown-table.svg\n\n[size]: https://bundlephobia.com/result?p=markdown-table\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esmsh]: https://esm.sh\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[typescript]: https://www.typescriptlang.org\n\n[contribute]: https://opensource.guide/how-to-contribute/\n\n[gfm]: https://docs.github.com/en/github/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables\n\n[text-table]: https://github.com/substack/text-table\n\n[string-width]: https://github.com/sindresorhus/string-width\n\n[mdast-util-to-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown\n\n[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm\n","publish_time":1579798108916,"_cnpm_publish_time":1579798108916,"dist-tags":{"latest":"3.1.0"}}