badgetable
v1.1.3
Published
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.
Downloads
18
Maintainers
Readme
Badge Table Generator
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.
Features
- 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.
npm init -y
npm i badgetable
Example
| Title | Article | Updated | Stars | Commits | Issues | Tests | License | | :-- | :-- | :-- | :-- | :-- | :-- | :-- | :-- | | Ascii to svg Generator | | | | | | | | | Badge Table | X | | | | | | |
Implementation: ./presets.md#githubOverviewWithArticle
See #presets for more examples.
Table of Contents
Methods
The following methods are publicly accessible. getTable
generates the actual table, while all other methods assist in displaying manually created tables.
npm init -y
npm i badgetable
.getTable()
This method generates the desired table. The form is determined by the preset
parameter.
Method
.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
|
| projects | Array of Objects | | The projects to include in the table. | true
|
| sort | Boolean | true
| Whether to sort the table. | false
|
| footer | Boolean | true
| Whether to include a footer in the table. | false
|
| header | Boolean | false
| Whether to include a header in the table. | false
|
See Presets for examples.
Returns
String (markdown)
.getPresets()
This helper method returns an array of strings containing all available presets
.
Method
.getPresets()
Return
Array of Strings
.getConfig()
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
.getConfig()
Returns
Object
Retrieve the default configuration after auto-generation. This can be useful if you want to create your custom configuration.
.setConfig()
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
.setConfig( { config, init=false } )
| Name | Type | Default | Description | Required |
| ------------- | --------------------- | ------- | --------------------------------------------------- | -------- |
| config | Object | | The configuration to set for the function. | true
|
| init | Boolean | false
| 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 "}}".
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
Presets
Here are all the presets listed as an overview. A detailed description for each example is stored in ./preset.md.
documentation
| Title | Uptime | Url | | :-- | :-- | :-- | | | | https://docs.statosio.com/ | | | | https://docs.statosio.com/ |
Implementation: ./presets.md#documentation
dynamicPackageSearch
| Title | Updated | Package | | :-- | :-- | :-- | | Easy Mina | | | | Mina Data | | |
Implementation: ./presets.md#dynamicPackageSearch
gemPackages
| Title | Version | Updated | Statistics | License | | :-- | :-- | :-- | :-- | :-- | | Feed Into | | | | | | Masked Ape Club | | | | |
Implementation: ./presets.md#gemPackages
gemPackagesCircleCi
| Title | Version | Updated | Statistics | Tests | License | | :-- | :-- | :-- | :-- | :-- | :-- | | Feed Into | | | | | | | Masked Ape Club | | | | | |
Implementation: ./presets.md#gemPackagesCircleCi
githubActivity
| Title | Updated | Stars | Commits | Contributors | License | | :-- | :-- | :-- | :-- | :-- | :-- | | Ascii to svg Generator | | | | | | | Badge Table | | | | | |
Implementation: ./presets.md#githubActivity
githubAdvanced
| Title | Updated | Stars | Commits | Contributors | Files | Size | License | | :-- | :-- | :-- | :-- | :-- | :-- | :-- | :-- | | Ascii to svg Generator | | | | | | | | | Badge Table | | | | | | | |
Implementation: ./presets.md#githubAdvanced
githubMinimal
| Title | Updated | License | | :-- | :-- | :-- | | Ascii to svg Generator | | | | Badge Table | | |
Implementation: ./presets.md#githubMinimal
githubOverview
| Title | Updated | Stars | Commits | Issues | Tests | License | | :-- | :-- | :-- | :-- | :-- | :-- | :-- | | Ascii to svg Generator | | | | | | | | Badge Table | | | | | | |
Implementation: ./presets.md#githubOverview
githubOverviewWithArticle
| Title | Article | Updated | Stars | Commits | Issues | Tests | License | | :-- | :-- | :-- | :-- | :-- | :-- | :-- | :-- | | Ascii to svg Generator | | | | | | | | | Badge Table | X | | | | | | |
Implementation: ./presets.md#githubOverviewWithArticle
githubStats
| Title | Updated | Stars | Files | Size | License | | :-- | :-- | :-- | :-- | :-- | :-- | | Ascii to svg Generator | | | | | | | Badge Table | | | | | |
Implementation: ./presets.md#githubStats
npmPackages
| Title | Version | Updated | Statistics | License | | :-- | :-- | :-- | :-- | :-- | | Badge Table | | | | | | Easy Mina | | | | |
Implementation: ./presets.md#npmPackages
npmPackagesCircleCi
| Title | Version | Updated | Statistics | Tests | License | | :-- | :-- | :-- | :-- | :-- | :-- | | Badge Table | | | | | | | Easy Mina | | | | | |
Implementation: ./presets.md#npmPackagesCircleCi
npmPackagesCircleCiWithArticle
| Title | Article | Version | Updated | Statistics | Tests | License | | :-- | :-- | :-- | :-- | :-- | :-- | :-- | | Badge Table | X | | | | | | | Easy Mina | | | | | | |
Implementation: ./presets.md#npmPackagesCircleCiWithArticle
License
The module is available as open source under the terms of the MIT.