remark-github
Advanced tools
Comparing version 7.0.0 to 7.0.1
@@ -8,3 +8,4 @@ 'use strict'; | ||
module.exports = exports = hash; | ||
exports = hash; | ||
module.exports = exports; | ||
@@ -11,0 +12,0 @@ exports.locator = locator(/\b[a-f0-9]{7,40}\b/gi); |
@@ -7,3 +7,4 @@ 'use strict'; | ||
module.exports = exports = issue; | ||
exports = issue; | ||
module.exports = exports; | ||
@@ -10,0 +11,0 @@ exports.locator = locator(/\bgh-|#/gi); |
'use strict'; | ||
var has = require('has'); | ||
var locator = require('../locator/mention'); | ||
@@ -8,3 +7,4 @@ var gh = require('../util/gh'); | ||
module.exports = exports = mention; | ||
exports = mention; | ||
module.exports = exports; | ||
@@ -14,2 +14,4 @@ exports.locator = locator; | ||
var own = {}.hasOwnProperty; | ||
var C_SLASH = '/'; | ||
@@ -25,6 +27,7 @@ var C_AT = '@'; | ||
* To my knowledge, there are no other magical usernames. */ | ||
var OVERWRITES = {}; | ||
var OVERWRITES = { | ||
mention: 'blog/821', | ||
mentions: 'blog/821' | ||
}; | ||
OVERWRITES.mentions = OVERWRITES.mention = 'blog/821'; | ||
/* Tokenise a mention. */ | ||
@@ -70,3 +73,3 @@ function mention(eat, value, silent) { | ||
href = gh(); | ||
href += has(OVERWRITES, handle) ? OVERWRITES[handle] : handle; | ||
href += own.call(OVERWRITES, handle) ? OVERWRITES[handle] : handle; | ||
@@ -73,0 +76,0 @@ now.column++; |
@@ -12,3 +12,4 @@ 'use strict'; | ||
module.exports = exports = repoReference; | ||
exports = repoReference; | ||
module.exports = exports; | ||
@@ -88,3 +89,4 @@ exports.locator = locator; | ||
content = reference = value.slice(referenceStart, index); | ||
reference = value.slice(referenceStart, index); | ||
content = reference; | ||
@@ -91,0 +93,0 @@ /* istanbul ignore if - maybe used by plug-ins */ |
@@ -8,3 +8,4 @@ 'use strict'; | ||
module.exports = exports = parse; | ||
exports = parse; | ||
module.exports = exports; | ||
@@ -11,0 +12,0 @@ exports.COMMIT = 'commit'; |
{ | ||
"name": "remark-github", | ||
"version": "7.0.0", | ||
"version": "7.0.1", | ||
"description": "Auto-link references like in GitHub issues, PRs, and comments", | ||
@@ -26,3 +26,2 @@ "license": "MIT", | ||
"dependencies": { | ||
"has": "^1.0.1", | ||
"is-alphabetical": "^1.0.0", | ||
@@ -41,11 +40,11 @@ "is-decimal": "^1.0.0", | ||
"esmangle": "^1.0.0", | ||
"nyc": "^10.0.0", | ||
"nyc": "^11.0.2", | ||
"remark": "^7.0.0", | ||
"remark-cli": "^2.0.0", | ||
"remark-preset-wooorm": "^1.0.0", | ||
"remark-cli": "^3.0.0", | ||
"remark-preset-wooorm": "^3.0.0", | ||
"tape": "^4.4.0", | ||
"xo": "^0.17.1" | ||
"xo": "^0.18.0" | ||
}, | ||
"scripts": { | ||
"build-md": "remark *.md --quiet --frail", | ||
"build-md": "remark *.md -qfo", | ||
"build-bundle": "browserify index.js -s remarkGitHub > remark-github.js", | ||
@@ -67,2 +66,3 @@ "build-mangle": "esmangle remark-github.js > remark-github.min.js", | ||
"space": true, | ||
"esnext": false, | ||
"ignores": [ | ||
@@ -73,5 +73,6 @@ "remark-github.js" | ||
"remarkConfig": { | ||
"output": true, | ||
"presets": "wooorm" | ||
"plugins": [ | ||
"preset-wooorm" | ||
] | ||
} | ||
} |
119
readme.md
@@ -16,51 +16,61 @@ # remark-github [![Build Status][build-badge]][build-status] [![Coverage Status][coverage-badge]][coverage-status] [![Chat][chat-badge]][chat] | ||
Say we have the following file, `example.md`: | ||
```markdown | ||
Some references: | ||
- Commit: f8083175fe890cbf14f41d0a06e7aa35d4989587 | ||
- Commit (fork): foo@f8083175fe890cbf14f41d0a06e7aa35d4989587 | ||
- Commit (repo): wooorm/remark@e1aa9f6c02de18b9459b7d269712bcb50183ce89 | ||
- Issue or PR (`#`): #1 | ||
- Issue or PR (`GH-`): GH-1 | ||
- Issue or PR (fork): foo#1 | ||
- Issue or PR (project): wooorm/remark#1 | ||
- Mention: @wooorm | ||
Some links: | ||
- Commit: https://github.com/wooorm/remark/commit/e1aa9f6c02de18b9459b7d269712bcb50183ce89 | ||
- Commit comment: https://github.com/wooorm/remark/commit/ac63bc3abacf14cf08ca5e2d8f1f8e88a7b9015c#commitcomment-16372693 | ||
- Issue or PR: https://github.com/wooorm/remark/issues/182 | ||
- Issue or PR comment: https://github.com/wooorm/remark-github/issues/3#issue-151160339 | ||
- Mention: @ben-eb | ||
``` | ||
And our script, `example.js`, looks as follows: | ||
```javascript | ||
var vfile = require('to-vfile'); | ||
var remark = require('remark'); | ||
var github = require('remark-github'); | ||
var input = [ | ||
'References:', | ||
'', | ||
'* Commit: f8083175fe890cbf14f41d0a06e7aa35d4989587', | ||
'* Commit (fork): foo@f8083175fe890cbf14f41d0a06e7aa35d4989587.', | ||
'* Commit (repo): wooorm/remark@e1aa9f6c02de18b9459b7d269712bcb50183ce89.', | ||
'* Issue or PR (`#`): #1.', | ||
'* Issue or PR (`GH-`): GH-1.', | ||
'* Issue or PR (fork): foo#1.', | ||
'* Issue or PR (project): wooorm/remark#1.', | ||
'* Mention: @wooorm.', | ||
'', | ||
'Normalising of links:', | ||
'', | ||
'* Commit: https://github.com/wooorm/remark/commit/e1aa9f6c02de18b9459b7d269712bcb50183ce89.', | ||
'* Commit comment: https://github.com/wooorm/remark/commit/ac63bc3abacf14cf08ca5e2d8f1f8e88a7b9015c#commitcomment-16372693.', | ||
'* Issue or PR: https://github.com/wooorm/remark/issues/182', | ||
'* Issue or PR comment: https://github.com/wooorm/remark-github/issues/3#issue-151160339', | ||
'* Mention: @ben-eb.' | ||
].join('\n'); | ||
console.log(remark().use(github).processSync(input).toString()); | ||
remark() | ||
.use(github) | ||
.process(vfile.readSync('example.md'), function (err, file) { | ||
if (err) throw err; | ||
console.log(String(file)); | ||
}); | ||
``` | ||
Yields: | ||
Now, running `node example` yields: | ||
```markdown | ||
References: | ||
Some references: | ||
- Commit: [`f808317`](https://github.com/wooorm/remark-github/commit/f8083175fe890cbf14f41d0a06e7aa35d4989587) | ||
- Commit (fork): [foo@`f808317`](https://github.com/foo/remark-github/commit/f8083175fe890cbf14f41d0a06e7aa35d4989587). | ||
- Commit (repo): [wooorm/remark@`e1aa9f6`](https://github.com/wooorm/remark/commit/e1aa9f6c02de18b9459b7d269712bcb50183ce89). | ||
- Issue or PR (`#`): [#1](https://github.com/wooorm/remark-github/issues/1). | ||
- Issue or PR (`GH-`): [GH-1](https://github.com/wooorm/remark-github/issues/1). | ||
- Issue or PR (fork): [foo#1](https://github.com/foo/remark-github/issues/1). | ||
- Issue or PR (project): [wooorm/remark#1](https://github.com/wooorm/remark/issues/1). | ||
- Mention: [**@wooorm**](https://github.com/wooorm). | ||
- Commit (fork): [foo@`f808317`](https://github.com/foo/remark-github/commit/f8083175fe890cbf14f41d0a06e7aa35d4989587) | ||
- Commit (repo): [wooorm/remark@`e1aa9f6`](https://github.com/wooorm/remark/commit/e1aa9f6c02de18b9459b7d269712bcb50183ce89) | ||
- Issue or PR (`#`): [#1](https://github.com/wooorm/remark-github/issues/1) | ||
- Issue or PR (`GH-`): [GH-1](https://github.com/wooorm/remark-github/issues/1) | ||
- Issue or PR (fork): [foo#1](https://github.com/foo/remark-github/issues/1) | ||
- Issue or PR (project): [wooorm/remark#1](https://github.com/wooorm/remark/issues/1) | ||
- Mention: [**@wooorm**](https://github.com/wooorm) | ||
Normalising of links: | ||
Some links: | ||
- Commit: [wooorm/remark@`e1aa9f6`](https://github.com/wooorm/remark/commit/e1aa9f6c02de18b9459b7d269712bcb50183ce89). | ||
- Commit comment: [wooorm/remark@`ac63bc3` (comment)](https://github.com/wooorm/remark/commit/ac63bc3abacf14cf08ca5e2d8f1f8e88a7b9015c#commitcomment-16372693). | ||
- Commit: [wooorm/remark@`e1aa9f6`](https://github.com/wooorm/remark/commit/e1aa9f6c02de18b9459b7d269712bcb50183ce89) | ||
- Commit comment: [wooorm/remark@`ac63bc3` (comment)](https://github.com/wooorm/remark/commit/ac63bc3abacf14cf08ca5e2d8f1f8e88a7b9015c#commitcomment-16372693) | ||
- Issue or PR: [wooorm/remark#182](https://github.com/wooorm/remark/issues/182) | ||
- Issue or PR comment: [#3 (comment)](https://github.com/wooorm/remark-github/issues/3#issue-151160339) | ||
- Mention: [**@ben-eb**](https://github.com/ben-eb). | ||
- Mention: [**@ben-eb**](https://github.com/ben-eb) | ||
``` | ||
@@ -73,17 +83,28 @@ | ||
Adds references to commits, issues, pull-requests, and users similar to how | ||
[GitHub][writing-on-github] | ||
renders these in issues, comments, and pull request descriptions. | ||
[GitHub][writing-on-github] renders these in issues, comments, and pull request | ||
descriptions. | ||
* Commits: `1f2a4fb` — [`1f2a4fb`][sha]. | ||
* Commits across forks: `wooorm@1f2a4fb` — [wooorm@`1f2a4fb`][user-sha]. | ||
* Commits across projects: `wooorm/remark-github@1f2a4fb` | ||
— [wooorm/remark-github@`1f2a4fb`][project-sha]. | ||
* Prefix issues: `GH-1` — [GH-1][issue]. | ||
* Hash issues: `#1` — [#1][issue]. | ||
* Issues across forks: `wooorm#1` — [wooorm#1][user-issue]. | ||
* Issues across projects: `wooorm/remark-github#1` | ||
— [wooorm/remark-github#1][project-issue]. | ||
* At-mentions: `@mention` and `@wooorm`. | ||
— [**@mention**][mentions] and [**@wooorm**][mention]. | ||
###### Conversion | ||
* Commits: | ||
`1f2a4fb` → [`1f2a4fb`][sha] | ||
* Commits across forks: | ||
`wooorm@1f2a4fb` → [wooorm@`1f2a4fb`][user-sha] | ||
* Commits across projects: | ||
`wooorm/remark-github@1f2a4fb` → | ||
[wooorm/remark-github@`1f2a4fb`][project-sha] | ||
* Prefix issues: | ||
`GH-1` → [GH-1][issue] | ||
* Hash issues: | ||
`#1` → [#1][issue] | ||
* Issues across forks: | ||
`wooorm#1` → [wooorm#1][user-issue] | ||
* Issues across projects: | ||
`wooorm/remark-github#1` → [wooorm/remark-github#1][project-issue] | ||
* At-mentions: | ||
`@mention` and `@wooorm` → | ||
[**@mention**][mentions] and [**@wooorm**][mention] | ||
###### Repository | ||
These links are generated relative to a project. In Node this is | ||
@@ -94,2 +115,4 @@ auto-detected by loading `package.json` and looking for a `repository` | ||
###### Mentions | ||
By default, mentions are wrapped in `strong` nodes (which render to | ||
@@ -96,0 +119,0 @@ `<strong>` in HTML), to simulate the look of mentions on GitHub. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27423
5
723
162
- Removedhas@^1.0.1
- Removedhas@1.0.4(transitive)