Skip to content

remark plugin to link references to commits, issues, pull-requests, and users, like on GitHub

License

Notifications You must be signed in to change notification settings

remarkjs/remark-github

remark-github Build Status Coverage Status

Auto-link references to commits, issues, pull-requests, and users like GitHub: Writing on GitHub.

Installation

npm

npm install remark-github

remark-github is also available for duo, and as an AMD, CommonJS, and globals module, uncompressed and compressed.

Table of Contents

Usage

Dependencies:

var github = require('remark-github'); var remark = require('remark').use(github);

Input:

var input = [ '* SHA: a5c3785ed8d6a35868bc169f07e40e889087fd2e', '* User@SHA: jlord@a5c3785ed8d6a35868bc169f07e40e889087fd2e', '* User/Repository@SHA: jlord/sheetsee.js@a5c3785e', '* #Num: #26', '* GH-Num: GH-26', '* User#Num: jlord#26', '* User/Repository#Num: jlord/sheetsee.js#26', '* @mention', '* And @mentioning someone else', '* And nothing.' ].join('\n');

Process:

var doc = remark.process(input);

Yields:

- SHA: [a5c3785](https://github.com/wooorm/remark-github/commit/a5c3785ed8d6a35868bc169f07e40e889087fd2e) - User@SHA: [jlord@a5c3785](https://github.com/jlord/remark-github/commit/a5c3785ed8d6a35868bc169f07e40e889087fd2e) - User/Repository@SHA: [jlord/sheetsee.js@a5c3785](https://github.com/jlord/sheetsee.js/commit/a5c3785e) - #Num: [#26](https://github.com/wooorm/remark-github/issues/26) - GH-Num: [GH-26](https://github.com/wooorm/remark-github/issues/26) - User#Num: [jlord#26](https://github.com/jlord/remark-github/issues/26) - User/Repository#Num: [jlord/sheetsee.js#26](https://github.com/jlord/sheetsee.js/issues/26) - [@mention](https://github.com/blog/821) - And [@mentioning](https://github.com/mentioning) someone else - And nothing.

API

remark.use(github, options)

Adds references to commits, issues, pull-requests, and users similar to how GitHub renders these in issues, comments, and pull request descriptions.

These links are generated relative to a project. In Node this is auto-detected by loading package.json and looking for a repository field. In the browser, or when overwriting this, you can pass a repository to remark.use.

License

MIT © Titus Wormer

About

remark plugin to link references to commits, issues, pull-requests, and users, like on GitHub

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

  •  

Contributors 8