planning
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s

This commit is contained in:
2024-10-14 09:15:30 +02:00
parent bcba00a730
commit 6e64e138e2
21059 changed files with 2317811 additions and 1 deletions

249
node_modules/markdown-table/index.js generated vendored Normal file
View File

@@ -0,0 +1,249 @@
'use strict'
var repeat = require('repeat-string')
module.exports = markdownTable
var trailingWhitespace = / +$/
// Characters.
var space = ' '
var lineFeed = '\n'
var dash = '-'
var colon = ':'
var verticalBar = '|'
var x = 0
var C = 67
var L = 76
var R = 82
var c = 99
var l = 108
var r = 114
// Create a table from a matrix of strings.
function markdownTable(table, options) {
var settings = options || {}
var padding = settings.padding !== false
var start = settings.delimiterStart !== false
var end = settings.delimiterEnd !== false
var align = (settings.align || []).concat()
var alignDelimiters = settings.alignDelimiters !== false
var alignments = []
var stringLength = settings.stringLength || defaultStringLength
var rowIndex = -1
var rowLength = table.length
var cellMatrix = []
var sizeMatrix = []
var row = []
var sizes = []
var longestCellByColumn = []
var mostCellsPerRow = 0
var cells
var columnIndex
var columnLength
var largest
var size
var cell
var lines
var line
var before
var after
var code
// This is a superfluous loop if we dont align delimiters, but otherwise wed
// do superfluous work when aligning, so optimize for aligning.
while (++rowIndex < rowLength) {
cells = table[rowIndex]
columnIndex = -1
columnLength = cells.length
row = []
sizes = []
if (columnLength > mostCellsPerRow) {
mostCellsPerRow = columnLength
}
while (++columnIndex < columnLength) {
cell = serialize(cells[columnIndex])
if (alignDelimiters === true) {
size = stringLength(cell)
sizes[columnIndex] = size
largest = longestCellByColumn[columnIndex]
if (largest === undefined || size > largest) {
longestCellByColumn[columnIndex] = size
}
}
row.push(cell)
}
cellMatrix[rowIndex] = row
sizeMatrix[rowIndex] = sizes
}
// Figure out which alignments to use.
columnIndex = -1
columnLength = mostCellsPerRow
if (typeof align === 'object' && 'length' in align) {
while (++columnIndex < columnLength) {
alignments[columnIndex] = toAlignment(align[columnIndex])
}
} else {
code = toAlignment(align)
while (++columnIndex < columnLength) {
alignments[columnIndex] = code
}
}
// Inject the alignment row.
columnIndex = -1
columnLength = mostCellsPerRow
row = []
sizes = []
while (++columnIndex < columnLength) {
code = alignments[columnIndex]
before = ''
after = ''
if (code === l) {
before = colon
} else if (code === r) {
after = colon
} else if (code === c) {
before = colon
after = colon
}
// There *must* be at least one hyphen-minus in each alignment cell.
size = alignDelimiters
? Math.max(
1,
longestCellByColumn[columnIndex] - before.length - after.length
)
: 1
cell = before + repeat(dash, size) + after
if (alignDelimiters === true) {
size = before.length + size + after.length
if (size > longestCellByColumn[columnIndex]) {
longestCellByColumn[columnIndex] = size
}
sizes[columnIndex] = size
}
row[columnIndex] = cell
}
// Inject the alignment row.
cellMatrix.splice(1, 0, row)
sizeMatrix.splice(1, 0, sizes)
rowIndex = -1
rowLength = cellMatrix.length
lines = []
while (++rowIndex < rowLength) {
row = cellMatrix[rowIndex]
sizes = sizeMatrix[rowIndex]
columnIndex = -1
columnLength = mostCellsPerRow
line = []
while (++columnIndex < columnLength) {
cell = row[columnIndex] || ''
before = ''
after = ''
if (alignDelimiters === true) {
size = longestCellByColumn[columnIndex] - (sizes[columnIndex] || 0)
code = alignments[columnIndex]
if (code === r) {
before = repeat(space, size)
} else if (code === c) {
if (size % 2 === 0) {
before = repeat(space, size / 2)
after = before
} else {
before = repeat(space, size / 2 + 0.5)
after = repeat(space, size / 2 - 0.5)
}
} else {
after = repeat(space, size)
}
}
if (start === true && columnIndex === 0) {
line.push(verticalBar)
}
if (
padding === true &&
// Dont add the opening space if were not aligning and the cell is
// empty: there will be a closing space.
!(alignDelimiters === false && cell === '') &&
(start === true || columnIndex !== 0)
) {
line.push(space)
}
if (alignDelimiters === true) {
line.push(before)
}
line.push(cell)
if (alignDelimiters === true) {
line.push(after)
}
if (padding === true) {
line.push(space)
}
if (end === true || columnIndex !== columnLength - 1) {
line.push(verticalBar)
}
}
line = line.join('')
if (end === false) {
line = line.replace(trailingWhitespace, '')
}
lines.push(line)
}
return lines.join(lineFeed)
}
function serialize(value) {
return value === null || value === undefined ? '' : String(value)
}
function defaultStringLength(value) {
return value.length
}
function toAlignment(value) {
var code = typeof value === 'string' ? value.charCodeAt(0) : x
return code === L || code === l
? l
: code === R || code === r
? r
: code === C || code === c
? c
: x
}

22
node_modules/markdown-table/license generated vendored Normal file
View File

@@ -0,0 +1,22 @@
(The MIT License)
Copyright (c) 2014 Titus Wormer <tituswormer@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

80
node_modules/markdown-table/package.json generated vendored Normal file
View File

@@ -0,0 +1,80 @@
{
"name": "markdown-table",
"version": "2.0.0",
"description": "Markdown tables",
"license": "MIT",
"keywords": [
"text",
"markdown",
"table",
"align",
"rows",
"tabular"
],
"repository": "wooorm/markdown-table",
"bugs": "https://github.com/wooorm/markdown-table/issues",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"files": [
"index.js"
],
"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
}
}

259
node_modules/markdown-table/readme.md generated vendored Normal file
View File

@@ -0,0 +1,259 @@
# markdown-table
[![Build][build-badge]][build]
[![Coverage][coverage-badge]][coverage]
[![Downloads][downloads-badge]][downloads]
[![Size][size-badge]][size]
Generate fancy [Markdown][fancy] tables.
## Install
[npm][]:
```sh
npm install markdown-table
```
## Use
Typical usage (defaults to align left):
```js
var table = require('markdown-table')
table([
['Branch', 'Commit'],
['master', '0123456789abcdef'],
['staging', 'fedcba9876543210']
])
```
Yields:
```markdown
| Branch | Commit |
| ------- | ---------------- |
| master | 0123456789abcdef |
| staging | fedcba9876543210 |
```
With align:
```js
table(
[
['Beep', 'No.', 'Boop'],
['beep', '1024', 'xyz'],
['boop', '3388450', 'tuv'],
['foo', '10106', 'qrstuv'],
['bar', '45', 'lmno']
],
{align: ['l', 'c', 'r']}
)
```
Yields:
```markdown
| Beep | No. | Boop |
| :--- | :-----: | -----: |
| beep | 1024 | xyz |
| boop | 3388450 | tuv |
| foo | 10106 | qrstuv |
| bar | 45 | lmno |
```
## API
### `markdownTable(table[, options])`
Turns a given matrix of strings (an array of arrays of strings) into a table.
##### `options`
###### `options.align`
One style for all columns, or styles for their respective columns (`string` or
`Array.<string>`).
Each style is either `'l'` (left), `'r'` (right), or `'c'` (center).
Other values are treated as `''`, which doesnt place the colon in the alignment
row but does align left.
*Only the lowercased first character is used, so `Right` is fine.*
###### `options.padding`
Whether to add a space of padding between delimiters and cells (`boolean`,
default: `true`).
When `true`, there is padding:
```markdown
| Alpha | B |
| ----- | ----- |
| C | Delta |
```
When `false`, there is no padding:
```markdown
|Alpha|B |
|-----|-----|
|C |Delta|
```
###### `options.delimiterStart`
Whether to begin each row with the delimiter (`boolean`, default: `true`).
Note: please dont use this: it could create fragile structures that arent
understandable to some Markdown parsers.
When `true`, there are starting delimiters:
```markdown
| Alpha | B |
| ----- | ----- |
| C | Delta |
```
When `false`, there are no starting delimiters:
```markdown
Alpha | B |
----- | ----- |
C | Delta |
```
###### `options.delimiterEnd`
Whether to end each row with the delimiter (`boolean`, default: `true`).
Note: please dont use this: it could create fragile structures that arent
understandable to some Markdown parsers.
When `true`, there are ending delimiters:
```markdown
| Alpha | B |
| ----- | ----- |
| C | Delta |
```
When `false`, there are no ending delimiters:
```markdown
| Alpha | B
| ----- | -----
| C | Delta
```
###### `options.alignDelimiters`
Whether to align the delimiters (`boolean`, default: `true`).
By default, they are aligned:
```markdown
| Alpha | B |
| ----- | ----- |
| C | Delta |
```
Pass `false` to make them staggered:
```markdown
| Alpha | B |
| - | - |
| C | Delta |
```
###### `options.stringLength`
Method to detect the length of a cell (`Function`, default: `s => s.length`).
Full-width characters and ANSI-sequences all mess up delimiter alignment
when viewing the Markdown source.
To fix this, you have to pass in a `stringLength` option to detect the “visible”
length of a cell (note that what is and isnt visible depends on your editor).
Without such a function, the following:
```js
table([
['Alpha', 'Bravo'],
['中文', 'Charlie'],
['👩‍❤️‍👩', 'Delta']
])
```
Yields:
```markdown
| Alpha | Bravo |
| - | - |
| 中文 | Charlie |
| 👩‍❤️‍👩 | Delta |
```
With [`string-width`][string-width]:
```js
var width = require('string-width')
table(
[
['Alpha', 'Bravo'],
['中文', 'Charlie'],
['👩‍❤️‍👩', 'Delta']
],
{stringLength: width}
)
```
Yields:
```markdown
| Alpha | Bravo |
| ----- | ------- |
| 中文 | Charlie |
| 👩‍❤️‍👩 | Delta |
```
## Inspiration
The original idea and basic implementation was inspired by James Hallidays
[`text-table`][text-table] library.
## License
[MIT][license] © [Titus Wormer][author]
<!-- Definitions -->
[build-badge]: https://img.shields.io/travis/wooorm/markdown-table.svg
[build]: https://travis-ci.org/wooorm/markdown-table
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/markdown-table.svg
[coverage]: https://codecov.io/github/wooorm/markdown-table
[downloads-badge]: https://img.shields.io/npm/dm/markdown-table.svg
[downloads]: https://www.npmjs.com/package/markdown-table
[size-badge]: https://img.shields.io/bundlephobia/minzip/markdown-table.svg
[size]: https://bundlephobia.com/result?p=markdown-table
[npm]: https://docs.npmjs.com/cli/install
[license]: license
[author]: https://wooorm.com
[fancy]: https://help.github.com/articles/github-flavored-markdown/#tables
[text-table]: https://github.com/substack/text-table
[string-width]: https://github.com/sindresorhus/string-width