markdown-magic-github-contributors
v0.0.3
Published
Add github contributors to markdown file
Downloads
133
Readme
List Github Contributors Plugin
This markdown-magic will list out the contributors of your repository.
Install
npm i markdown-magic markdown-magic-github-contributors --save-dev
Usage
1. Add markdown-magic transform script
/* generate-docs.js */
const fs = require('fs')
const path = require('path')
const markdownMagic = require('markdown-magic')
const config = {
transforms: {
CONTRIBUTORS: require('markdown-magic-github-contributors')
}
}
const markdownPath = path.join(__dirname, 'README.md')
markdownMagic(markdownPath, config)
2. Add comment block in markdown
<!-- ⛔️ AUTO-GENERATED-CONTENT:START (CONTRIBUTORS) -->
table will be placed here
<!-- ⛔️ AUTO-GENERATED-CONTENT:END -->
3. Add docs build script to package.json
This is an option step but will allow you to generate docs easily with npm run docs
"scripts": {
"docs": "node generate-docs.js",
}
Options
repo
(string) (optional) - username/repoName
. Will use the current working directory git remote origin as a default.
format
(string) (optional) - Default is table. possible values: list
, aligned
, & table
. See example
Setting options
Global configuration
You can configure the plugin when required in as a tranform. This will apply to all instances of the <!-- ⛔️ AUTO-GENERATED-CONTENT (CONTRIBUTORS) -->
comment, unless overriden inline.
const fs = require('fs')
const path = require('path')
const markdownMagic = require('markdown-magic')
const config = {
transforms: {
CONTRIBUTORS: require('markdown-magic-github-contributors')({
format: 'list'
})
}
}
const markdownPath = path.join(__dirname, 'README.md')
markdownMagic(markdownPath, config)
Inline configuration
You can override global config settings with inline options like so:
<!-- ⛔️ AUTO-GENERATED-CONTENT:START (CONTRIBUTORS:format=list) -->
table will be placed here
<!-- ⛔️ AUTO-GENERATED-CONTENT:END -->
Prior Art
Many thanks to jonschlinkert and his github-contributors package that powers this under the hood.