remark-github
Advanced tools
Comparing version 6.0.1 to 7.0.0
12
index.js
@@ -1,14 +0,2 @@ | ||
/** | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @module remark:github | ||
* @fileoverview | ||
* Auto-link references like in GitHub issues, PRs, | ||
* and comments. | ||
*/ | ||
'use strict'; | ||
/* Expose. */ | ||
module.exports = require('./lib/index.js'); |
@@ -1,14 +0,3 @@ | ||
/** | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @module remark:github | ||
* @fileoverview | ||
* Auto-link references like in GitHub issues, PRs, | ||
* and comments. | ||
*/ | ||
'use strict'; | ||
/* Dependencies. */ | ||
var visit = require('unist-util-visit'); | ||
@@ -22,3 +11,2 @@ var parse = require('./util/parse-link'); | ||
/* Expose. */ | ||
module.exports = attacher; | ||
@@ -47,13 +35,7 @@ | ||
/** | ||
* Attacher. | ||
* | ||
* @param {Remark} remark - Instance. | ||
* @param {Object?} [options] - Configuration. | ||
* @return {Function} - Transformer. | ||
*/ | ||
function attacher(remark, options) { | ||
/* Attacher. */ | ||
function attacher(options) { | ||
var settings = options || {}; | ||
var repository = settings.repository; | ||
var proto = remark.Parser.prototype; | ||
var proto = this.Parser.prototype; | ||
var scope = proto.inlineTokenizers; | ||
@@ -66,5 +48,4 @@ var methods = proto.inlineMethods; | ||
try { | ||
pack = require(require('path').resolve( | ||
proc.cwd(), 'package.json' | ||
)); | ||
// eslint-disable-next-line import/no-dynamic-require | ||
pack = require(require('path').resolve(proc.cwd(), 'package.json')); | ||
} catch (err) { | ||
@@ -71,0 +52,0 @@ pack = {}; |
@@ -1,27 +0,8 @@ | ||
/** | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @module remark:github:locator:mention | ||
* @fileoverview Locate a mention. | ||
*/ | ||
'use strict'; | ||
/* Expose. */ | ||
module.exports = mention; | ||
/* Dependencies. */ | ||
var repo = require('../util/repo-character'); | ||
/** | ||
* Find a possible mention. | ||
* | ||
* @example | ||
* locateMention('foo @bar'); // 4 | ||
* | ||
* @param {string} value - Value to search. | ||
* @param {number} fromIndex - Index to start searching at. | ||
* @return {number} - Location of possible mention. | ||
*/ | ||
/* Find a possible mention. */ | ||
function mention(value, fromIndex) { | ||
@@ -28,0 +9,0 @@ var index = value.indexOf('@', fromIndex); |
@@ -1,15 +0,5 @@ | ||
/** | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @module remark:github:locator:repo | ||
* @fileoverview Locate a repo. | ||
*/ | ||
'use strict'; | ||
/* Expose. */ | ||
module.exports = locateRepoReference; | ||
/* Dependencies. */ | ||
var hexadecimal = require('is-hexadecimal'); | ||
@@ -19,12 +9,3 @@ var decimal = require('is-decimal'); | ||
/** | ||
* Find a possible reference. | ||
* | ||
* @example | ||
* locateRepoReference('foo bar/baz#1'); // 4 | ||
* | ||
* @param {string} value - Value to search. | ||
* @param {number} fromIndex - Index to start searching at. | ||
* @return {number} - Location of possible reference. | ||
*/ | ||
/* Find a possible reference. */ | ||
function locateRepoReference(value, fromIndex) { | ||
@@ -31,0 +12,0 @@ var hash = value.indexOf('@', fromIndex); |
@@ -1,12 +0,3 @@ | ||
/** | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @module remark:github:tokenizer:hash | ||
* @fileoverview Tokenize a hash. | ||
*/ | ||
'use strict'; | ||
/* Dependencies. */ | ||
var gh = require('../util/gh'); | ||
@@ -17,3 +8,2 @@ var shaEnd = require('../util/sha-end'); | ||
/* Expose. */ | ||
module.exports = exports = hash; | ||
@@ -40,15 +30,3 @@ | ||
/** | ||
* Tokenise a hash. | ||
* | ||
* @example | ||
* tokenizeHash(eat, 'bada555'); | ||
* | ||
* @property {boolean} notInLink - Disable nested links. | ||
* @property {Function} locator - Hash locator. | ||
* @param {function(string)} eat - Eater. | ||
* @param {string} value - Rest of content. | ||
* @param {boolean?} [silent] - Whether this is a dry run. | ||
* @return {Node?|boolean} - `link` node. | ||
*/ | ||
/* Tokenise a hash. */ | ||
function hash(eat, value, silent) { | ||
@@ -100,10 +78,5 @@ var self = this; | ||
/** | ||
* Check if a value is a SHA. | ||
* | ||
* @param {string} sha - Commit hash. | ||
* @return {boolean} - Whether `sha` is not blacklisted. | ||
*/ | ||
/* Check if a value is a SHA. */ | ||
function isBlacklisted(sha) { | ||
return BLACKLIST.indexOf(sha.toLowerCase()) !== -1; | ||
} |
@@ -1,12 +0,3 @@ | ||
/** | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @module remark:github:tokenizer:issue | ||
* @fileoverview Tokenize an issue. | ||
*/ | ||
'use strict'; | ||
/* Dependencies. */ | ||
var gh = require('../util/gh'); | ||
@@ -16,3 +7,2 @@ var issueEnd = require('../util/issue-end'); | ||
/* Expose. */ | ||
module.exports = exports = issue; | ||
@@ -23,26 +13,10 @@ | ||
/* Characters. */ | ||
var C_SLASH = '/'; | ||
var C_HASH = '#'; | ||
/* Character codes. */ | ||
var CC_HASH = C_HASH.charCodeAt(0); | ||
/* Constants. */ | ||
var PREFIX = 'gh-'; | ||
/** | ||
* Tokenise an issue. | ||
* | ||
* @example | ||
* tokenizeIssue(eat, 'GH-1'); | ||
* tokenizeIssue(eat, '#3'); | ||
* | ||
* @property {boolean} notInLink - Disable nested links. | ||
* @property {Function} locator - Issue locator. | ||
* @param {function(string)} eat - Eater. | ||
* @param {string} value - Rest of content. | ||
* @param {boolean?} [silent] - Whether this is a dry run. | ||
* @return {Node?|boolean} - `link` node. | ||
*/ | ||
/* Tokenise an issue. */ | ||
function issue(eat, value, silent) { | ||
@@ -49,0 +23,0 @@ var self = this; |
@@ -1,12 +0,3 @@ | ||
/** | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @module remark:github:tokenizer:mention | ||
* @fileoverview Tokenize a mention. | ||
*/ | ||
'use strict'; | ||
/* Dependencies. */ | ||
var has = require('has'); | ||
@@ -17,3 +8,2 @@ var locator = require('../locator/mention'); | ||
/* Expose. */ | ||
module.exports = exports = mention; | ||
@@ -24,7 +14,5 @@ | ||
/* Characters. */ | ||
var C_SLASH = '/'; | ||
var C_AT = '@'; | ||
/* Character codes. */ | ||
var CC_SLASH = C_SLASH.charCodeAt(0); | ||
@@ -41,15 +29,3 @@ var CC_AT = C_AT.charCodeAt(0); | ||
/** | ||
* Tokenise a mention. | ||
* | ||
* @example | ||
* tokenizeMention(eat, '@baz'); | ||
* | ||
* @property {boolean} notInLink - Disable nested links. | ||
* @property {Function} locator - Mention locator. | ||
* @param {function(string)} eat - Eater. | ||
* @param {string} value - Rest of content. | ||
* @param {boolean?} [silent] - Whether this is a dry run. | ||
* @return {Node?|boolean} - `link` node. | ||
*/ | ||
/* Tokenise a mention. */ | ||
function mention(eat, value, silent) { | ||
@@ -56,0 +32,0 @@ var self = this; |
@@ -1,12 +0,3 @@ | ||
/** | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @module remark:github:tokenizer:repo | ||
* @fileoverview Tokenize a repo. | ||
*/ | ||
'use strict'; | ||
/* Dependencies. */ | ||
var locator = require('../locator/repo'); | ||
@@ -21,3 +12,2 @@ var abbr = require('../util/abbreviate'); | ||
/* Expose. */ | ||
module.exports = exports = repoReference; | ||
@@ -28,6 +18,4 @@ | ||
/* Characters. */ | ||
var C_SLASH = '/'; | ||
/* Character codes. */ | ||
var CC_SLASH = C_SLASH.charCodeAt(0); | ||
@@ -37,15 +25,3 @@ var CC_HASH = '#'.charCodeAt(0); | ||
/** | ||
* Tokenise a reference. | ||
* | ||
* @example | ||
* repoReference(eat, 'foo@bada555'); | ||
* | ||
* @property {boolean} notInLink - Disable nested links. | ||
* @property {Function} locator - Reference locator. | ||
* @param {function(string)} eat - Eater. | ||
* @param {string} value - Rest of content. | ||
* @param {boolean?} [silent] - Whether this is a dry run. | ||
* @return {Node?|boolean} - `link` node. | ||
*/ | ||
/* Tokenise a reference. */ | ||
function repoReference(eat, value, silent) { | ||
@@ -52,0 +28,0 @@ var self = this; |
@@ -1,25 +0,10 @@ | ||
/** | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @module remark:github:util:abbreviate | ||
* @fileoverview Abbreviate a SHA. | ||
*/ | ||
'use strict'; | ||
/* Expose. */ | ||
module.exports = abbreviate; | ||
/* Constants. */ | ||
var MIN_SHA_LENGTH = 7; | ||
/** | ||
* Abbreviate a SHA. | ||
* | ||
* @param {string} sha - Commit hash. | ||
* @return {string} - Abbreviated sha. | ||
*/ | ||
/* Abbreviate a SHA. */ | ||
function abbreviate(sha) { | ||
return sha.slice(0, MIN_SHA_LENGTH); | ||
} |
@@ -1,22 +0,7 @@ | ||
/** | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @module remark:github:util:gh | ||
* @fileoverview Create a link base to GitHub. | ||
*/ | ||
'use strict'; | ||
/* Expose. */ | ||
module.exports = gh; | ||
/** | ||
* Return a URL to GitHub, relative to an optional | ||
* `repo` object, or `user` and `project`. | ||
* | ||
* @param {Object|string?} repo - Repository. | ||
* @param {string?} project - Project. | ||
* @return {string} - URL. | ||
*/ | ||
/* Return a URL to GitHub, relative to an optional | ||
* `repo` object, or `user` and `project`. */ | ||
function gh(repo, project) { | ||
@@ -23,0 +8,0 @@ var base = 'https://github.com/'; |
@@ -1,25 +0,9 @@ | ||
/** | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @module remark:github:util:issue-end | ||
* @fileoverview Get the end position of an issue. | ||
*/ | ||
'use strict'; | ||
/* Dependencies. */ | ||
var decimal = require('is-decimal'); | ||
/* Expose. */ | ||
module.exports = issue; | ||
/** | ||
* Get the end of an issue which starts at character | ||
* `fromIndex` in `value`. | ||
* | ||
* @param {string} value - Value to check. | ||
* @param {number} fromIndex - Index to start searching at. | ||
* @return {number} - End position of issue, or `-1`. | ||
*/ | ||
/* Get the end of an issue which starts at character | ||
* `fromIndex` in `value`. */ | ||
function issue(value, fromIndex) { | ||
@@ -26,0 +10,0 @@ var index = fromIndex; |
@@ -1,12 +0,3 @@ | ||
/** | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @module remark:github:util:parse-link | ||
* @fileoverview Parse a link to GH. | ||
*/ | ||
'use strict'; | ||
/* Dependencies. */ | ||
var toString = require('mdast-util-to-string'); | ||
@@ -17,3 +8,2 @@ var usernameEnd = require('./username-end'); | ||
/* Expose. */ | ||
module.exports = exports = parse; | ||
@@ -25,16 +15,9 @@ | ||
/* Constants. */ | ||
var GH_URL_PREFIX = 'https://github.com/'; | ||
var GH_URL_PREFIX_LENGTH = GH_URL_PREFIX.length; | ||
/* Character codes. */ | ||
var CC_SLASH = '/'.charCodeAt(0); | ||
var CC_HASH = '#'.charCodeAt(0); | ||
/** | ||
* Parse a link and determine whether it links to GitHub. | ||
* | ||
* @param {LinkNode} node - Link node. | ||
* @return {Object?} - Information. | ||
*/ | ||
/* Parse a link and determine whether it links to GitHub. */ | ||
function parse(node) { | ||
@@ -41,0 +24,0 @@ var link = {}; |
@@ -1,29 +0,12 @@ | ||
/** | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @module remark:github:util:project-character | ||
* @fileoverview Check if a character can be in a project. | ||
*/ | ||
'use strict'; | ||
/* Dependencies. */ | ||
var decimal = require('is-decimal'); | ||
var alphabetical = require('is-alphabetical'); | ||
/* Expose. */ | ||
module.exports = projectCharacter; | ||
/* Character codes. */ | ||
var CC_DOT = '.'.charCodeAt(0); | ||
var CC_DASH = '-'.charCodeAt(0); | ||
/** | ||
* Check whether `code` is a valid project name character. | ||
* | ||
* @param {number} code - Single character code to check. | ||
* @return {boolean} - Whether or not `code` is a valid | ||
* project name character. | ||
*/ | ||
/* Check whether `code` is a valid project name character. */ | ||
function projectCharacter(code) { | ||
@@ -30,0 +13,0 @@ return code === CC_DOT || |
@@ -1,29 +0,12 @@ | ||
/** | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @module remark:github:util:project-end | ||
* @fileoverview Get the end position of a project. | ||
*/ | ||
'use strict'; | ||
/* Dependencies. */ | ||
var projectCharacter = require('./project-character'); | ||
/* Expose. */ | ||
module.exports = project; | ||
/* Constants. */ | ||
var GIT_SUFFIX = '.git'; | ||
var MAX_PROJECT_LENGTH = 100; | ||
/** | ||
* Get the end of a project which starts at character | ||
* `fromIndex` in `value`. | ||
* | ||
* @param {string} value - Value to check. | ||
* @param {number} fromIndex - Index to start searching at. | ||
* @return {number} - End position of project, or `-1`. | ||
*/ | ||
/* Get the end of a project which starts at character | ||
* `fromIndex` in `value`. */ | ||
function project(value, fromIndex) { | ||
@@ -30,0 +13,0 @@ var index = fromIndex; |
@@ -1,45 +0,18 @@ | ||
/** | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @module remark:github:util:regex-locator | ||
* @fileoverview Create a locator from a regex. | ||
*/ | ||
'use strict'; | ||
/* Dependencies. */ | ||
var usernameCharacter = require('./username-character'); | ||
/* Expose. */ | ||
module.exports = factory; | ||
/* Characters. */ | ||
var C_AT = '@'; | ||
var C_HASH = '#'; | ||
/* Character codes. */ | ||
var CC_HASH = C_HASH.charCodeAt(0); | ||
var CC_AT = C_AT.charCodeAt(0); | ||
/** | ||
* Create a bound regex locator. | ||
* | ||
* @example | ||
* regexLocatorFactory(/-/g); | ||
* | ||
* @param {RegExp} regex - Expressions to bind to. | ||
* @return {Function} - Locator. | ||
*/ | ||
/* Create a bound regex locator. */ | ||
function factory(regex) { | ||
/** | ||
* Find the place where a regex begins. | ||
* | ||
* @example | ||
* regexLocatorFactory(/-/g)('foo - bar'); // 4 | ||
* | ||
* @param {string} value - Value to search. | ||
* @param {number} fromIndex - Index to start searching at. | ||
* @return {number} - Location of match. | ||
*/ | ||
return locator; | ||
/* Find the place where a regex begins. */ | ||
function locator(value, fromIndex) { | ||
@@ -71,4 +44,2 @@ var result; | ||
} | ||
return locator; | ||
} |
@@ -1,19 +0,8 @@ | ||
/** | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @module remark:github:util:repo-character | ||
* @fileoverview Check if a character can be in a repo. | ||
*/ | ||
'use strict'; | ||
/* Dependencies. */ | ||
var decimal = require('is-decimal'); | ||
var alphabetical = require('is-alphabetical'); | ||
/* Expose. */ | ||
module.exports = repoCharacter; | ||
/* Character codes. */ | ||
var CC_DASH = '-'.charCodeAt(0); | ||
@@ -23,9 +12,3 @@ var CC_SLASH = '/'.charCodeAt(0); | ||
/** | ||
* Check whether `code` is a repo character. | ||
* | ||
* @param {number} code - Single character code to check. | ||
* @return {boolean} - Whether or not `code` is a valid | ||
* repo character. | ||
*/ | ||
/* Check whether `code` is a repo character. */ | ||
function repoCharacter(code) { | ||
@@ -32,0 +15,0 @@ return code === CC_SLASH || |
@@ -1,18 +0,7 @@ | ||
/** | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @module remark:github:util:sha-end | ||
* @fileoverview Get the end position of a SHA. | ||
*/ | ||
'use strict'; | ||
/* Dependencies. */ | ||
var hexadecimal = require('is-hexadecimal'); | ||
/* Expose. */ | ||
module.exports = sha; | ||
/* Constants. */ | ||
var MAX_SHA_LENGTH = 40; | ||
@@ -22,12 +11,4 @@ var MINUSCULE_SHA_LENGTH = 4; | ||
/** | ||
* Get the end of a SHA which starts at character | ||
* `fromIndex` in `value`. | ||
* | ||
* @param {string} value - Value to check. | ||
* @param {number} fromIndex - Index to start searching at. | ||
* @param {boolean} [allowShort=false] - Whether to allow | ||
* extra short SHAs (4 characters instead of 7). | ||
* @return {number} - End position of SHA, or `-1`. | ||
*/ | ||
/* Get the end of a SHA which starts at character | ||
* `fromIndex` in `value`. */ | ||
function sha(value, fromIndex, allowShort) { | ||
@@ -34,0 +15,0 @@ var index = fromIndex; |
@@ -1,30 +0,13 @@ | ||
/** | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @module remark:github:util:username-character | ||
* @fileoverview Check if a character can be in a username. | ||
*/ | ||
'use strict'; | ||
/* Dependencies. */ | ||
var decimal = require('is-decimal'); | ||
var alphabetical = require('is-alphabetical'); | ||
/* Expose. */ | ||
module.exports = usernameCharacter; | ||
/* Character codes. */ | ||
var CC_DASH = '-'.charCodeAt(0); | ||
/** | ||
* Check whether `code` is a valid username character. | ||
* | ||
* @param {number} code - Single character code to check. | ||
* @return {boolean} - Whether or not `code` is a valid | ||
* username character. | ||
*/ | ||
/* Check whether `code` is a valid username character. */ | ||
function usernameCharacter(code) { | ||
return code === CC_DASH || decimal(code) || alphabetical(code); | ||
} |
@@ -1,31 +0,13 @@ | ||
/** | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @module remark:github:util:username-end | ||
* @fileoverview Get the end position of a username. | ||
*/ | ||
'use strict'; | ||
/* Dependencies. */ | ||
var usernameCharacter = require('./username-character'); | ||
/* Expose. */ | ||
module.exports = username; | ||
/* Constants */ | ||
var MAX_USER_LENGTH = 39; | ||
/* Character codes */ | ||
var CC_DASH = '-'.charCodeAt(0); | ||
/** | ||
* Get the end of a username which starts at character | ||
* `fromIndex` in `value`. | ||
* | ||
* @param {string} value - Value to check. | ||
* @param {number} fromIndex - Index to start searching at. | ||
* @return {number} - End position of username, or `-1`. | ||
*/ | ||
/* Get the end of a username which starts at character | ||
* `fromIndex` in `value`. */ | ||
function username(value, fromIndex) { | ||
@@ -32,0 +14,0 @@ var index = fromIndex; |
{ | ||
"name": "remark-github", | ||
"version": "6.0.1", | ||
"version": "7.0.0", | ||
"description": "Auto-link references like in GitHub issues, PRs, and comments", | ||
@@ -25,5 +25,2 @@ "license": "MIT", | ||
], | ||
"engines": { | ||
"node": ">=0.11.0" | ||
}, | ||
"dependencies": { | ||
@@ -42,10 +39,10 @@ "has": "^1.0.1", | ||
"devDependencies": { | ||
"browserify": "^13.0.0", | ||
"browserify": "^14.0.0", | ||
"esmangle": "^1.0.0", | ||
"nyc": "^8.0.0", | ||
"remark": "^6.0.0", | ||
"nyc": "^10.0.0", | ||
"remark": "^7.0.0", | ||
"remark-cli": "^2.0.0", | ||
"remark-preset-wooorm": "^1.0.0", | ||
"tape": "^4.4.0", | ||
"xo": "^0.16.0" | ||
"xo": "^0.17.1" | ||
}, | ||
@@ -52,0 +49,0 @@ "scripts": { |
@@ -16,18 +16,6 @@ # remark-github [![Build Status][build-badge]][build-status] [![Coverage Status][coverage-badge]][coverage-status] [![Chat][chat-badge]][chat] | ||
Dependencies: | ||
```javascript | ||
var remark = require('remark'); | ||
var github = require('remark-github'); | ||
``` | ||
Processor: | ||
```javascript | ||
var processor = remark().use(github); | ||
``` | ||
Input: | ||
```javascript | ||
var input = [ | ||
@@ -53,8 +41,4 @@ 'References:', | ||
].join('\n'); | ||
``` | ||
Process: | ||
```javascript | ||
var doc = processor.process(input).toString(); | ||
console.log(remark().use(github).processSync(input).toString()); | ||
``` | ||
@@ -61,0 +45,0 @@ |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
27165
715
139