Helps create summary tables for modules and websites by adding badges through shields.io. It generates complex Markdown code with a simple payload for an easy-to-understand visual overview.
npm install badgetableHelps create summary tables for modules and websites by adding badges through shields.io. It generates complex Markdown code with a simple payload for an easy-to-understand visual overview.
- Creates an overview in the form of a markdown table.
- Users can choose from various predefined presets.
- Dynamic information can be inserted into individual cells using, for example, shields.io badges.
- Customized to meet the needs of open-source repository maintainers. To efficiently monitor metrics from various repositories.
``shell`
npm init -y
npm i badgetable
| Title | Article | Updated | Stars | Commits | Issues | Tests | License |
| :-- | :-- | :-- | :-- | :-- | :-- | :-- | :-- |
| Ascii to svg Generator | | |
|
|
|
|
|
| Badge Table | X | |
|
|
|
|
|
Implementation: ./presets.md#githubOverviewWithArticle
See #presets for more examples.
- Example
- Table of Contents
- Methods
- .getTable()
- .getPresets()
- .getConfig()
- .setConfig()
- Presets
- documentation
- dynamicPackageSearch
- gemPackages
- gemPackagesCircleCi
- githubActivity
- githubAdvanced
- githubMinimal
- githubOverview
- githubOverviewWithArticle
- githubStats
- npmPackages
- npmPackagesCircleCi
- License
The following methods are publicly accessible. getTable generates the actual table, while all other methods assist in displaying manually created tables.
`shell`
npm init -y
npm i badgetable
This method generates the desired table. The form is determined by the preset parameter.
Method
`javascript`
.getTable( { preset, projects, sort=true, footer=true, header=false } )
| Name | Type | Default | Description | Required |
| ------------- | --------------------- | ------- | --------------------------------------------------- | -------- |
| preset | String | | The preset to use for generating the table. | true |true
| projects | Array of Objects | | The projects to include in the table. | |true
| sort | Boolean | | Whether to sort the table. | false |true
| footer | Boolean | | Whether to include a footer in the table. | false |false
| header | Boolean | | Whether to include a header in the table. | false |
See Presets for examples.
Returns
`String (markdown)`
This helper method returns an array of strings containing all available presets.
Method
`javascript`
.getPresets()
Return
``
Array of Strings
This method returns the currently active configuration. This object also contains the respective presets needed to generate a table. To create a custom table, see .setConfig().
Method
`javascript`
.getConfig()
Returns
`Object`
Retrieve the default configuration after auto-generation. This can be useful if you want to create your custom configuration.
This method allows you to adjust the configuration, for example, to insert your custom template.
> Contribution welcome, we are happy to expand the standard presets. Please send us your suggestions.
Method
`javascript`
.setConfig( { config, init=false } )
| Name | Type | Default | Description | Required |
| ------------- | --------------------- | ------- | --------------------------------------------------- | -------- |
| config | Object | | The configuration to set for the function. | true |false
| init | Boolean | | Do not provide this parameter. | false |
Example
To customize your configuration, you can provide your own config. It is recommended to modify the default configuration. The configuration distinguishes between Badges, Columns, and Presets. Within Badges, each badge is defined using a struct. The wrapperUrl can be used to create a clickable link, and the shield represents the actual badge content. The struct expects pseudo-HTML enclosed in "<<" and ">>". Variables within the payload are denoted by "{{" and "}}".
`javascript
import { BadgeTable } from 'badgetable'
const btg = new BadgeTable( true )
const yourConfig = {}
const myconfig = btg.getConfig()
myconfig['presets']['githubMinimal']['struct'] = [
[ 'tree__columns__text', 'tree__markdown__alignment__left' ],
[ 'tree__columns__githubUpdated', 'tree__markdown__alignment__left' ],
[ 'tree__columns__license', 'tree__markdown__alignment__left' ]
]
const markDown = btg
.setConfig( yourConfig )
// .getTable( { 'preset': 'githubMinimal', projects, sort } )
`
Returns
`Boolean``
|
| Implementation: ./presets.md#documentation
Implementation: ./presets.md#documentationRepository
Implementation: ./presets.md#documentationRepositoryCircleCi
Implementation: ./presets.md#dynamicPackageSearch
Implementation: ./presets.md#gemPackages
Implementation: ./presets.md#gemPackagesCircleCi
Implementation: ./presets.md#githubActivity
Implementation: ./presets.md#githubAdvanced
Implementation: ./presets.md#githubDetails
Implementation: ./presets.md#githubDetailsCircleCi
Implementation: ./presets.md#githubDetailsCodeCoverage
Implementation: ./presets.md#githubMinimal
Implementation: ./presets.md#githubOverview
Implementation: ./presets.md#githubOverviewWithArticle
Implementation: ./presets.md#githubStats
Implementation: ./presets.md#npmPackages
Implementation: ./presets.md#npmPackagesCircleCi
Implementation: ./presets.md#npmPackagesCircleCiWithArticle
The module is available as open source under the terms of the MIT.