Auto-link references to commits, issues, pull-requests, and users like GitHub: Writing on GitHub.
npm install remark-githubremark-github is also available for duo, and as an AMD, CommonJS, and globals module, uncompressed and compressed.
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.Adds references to commits, issues, pull-requests, and users similar to how GitHub renders these in issues, comments, and pull request descriptions.
-
SHA commits references:
e2c1dc7690932b0cef900fa4e7355df093448341— e2c1dc7 -
User@SHA:
wooorm@e2c1dc7690932b0cef900fa4e7355df093448341— wooorm@e2c1dc7 -
User/Repository@SHA:
wooorm/remark-github@e2c1dc7690932b0cef900fa4e7355df093448341— wooorm/remark-github@e2c1dc7 -
Hash-Num:
#1— #1 -
GH-Num:
GH-1— GH-1 -
User#Num:
wooorm#1— wooorm#1 -
User/Repository#Num:
wooorm/remark-github#1— wooorm/remark-github#1
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.