Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

remark-github

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark-github - npm Package Compare versions

Comparing version 7.0.1 to 7.0.2

94

lib/index.js

@@ -11,3 +11,3 @@ 'use strict';

module.exports = attacher;
module.exports = github;

@@ -17,2 +17,11 @@ /* Hide process use from browserify. */

/* Load `fs` and `path` if available. */
var fs;
var path;
try {
fs = require('fs');
path = require('path');
} catch (err) {}
/* Username may only contain alphanumeric characters or

@@ -32,8 +41,5 @@ * single hyphens, and cannot begin or end with a hyphen.

/* Match a repo from a git / github URL. */
var REPOSITORY = new RegExp(
'(?:^|/(?:repos/)?)' + REPO + '(?=\\.git|[\\/#@]|$)', 'i'
);
var REPOSITORY = new RegExp('(?:^|/(?:repos/)?)' + REPO + '(?=\\.git|[\\/#@]|$)', 'i');
/* Attacher. */
function attacher(options) {
function github(options) {
var settings = options || {};

@@ -49,4 +55,3 @@ var repository = settings.repository;

try {
// eslint-disable-next-line import/no-dynamic-require
pack = require(require('path').resolve(proc.cwd(), 'package.json'));
pack = JSON.parse(fs.readFileSync(path.join(proc.cwd(), 'package.json')));
} catch (err) {

@@ -94,52 +99,49 @@ pack = {};

/**
* Transformer.
*
* @param {Node} tree - Root node.
*/
function transformer(tree) {
visit(tree, 'link', function (node) {
var link = parse(node);
var children;
var base;
var comment;
visit(tree, 'link', visitor);
}
if (!link) {
return;
}
function visitor(node) {
var link = parse(node);
var children;
var base;
var comment;
comment = link.comment ? ' (comment)' : '';
if (!link) {
return;
}
if (link.project !== repository.project) {
base = link.user + '/' + link.project;
} else if (link.user === repository.user) {
base = '';
} else {
base = link.user;
}
comment = link.comment ? ' (comment)' : '';
if (link.page === parse.COMMIT) {
children = [];
if (link.project !== repository.project) {
base = link.user + '/' + link.project;
} else if (link.user === repository.user) {
base = '';
} else {
base = link.user;
}
if (base) {
children.push({type: 'text', value: base + '@'});
}
if (link.page === parse.COMMIT) {
children = [];
children.push({type: 'inlineCode', value: abbr(link.reference)});
if (base) {
children.push({type: 'text', value: base + '@'});
}
if (link.comment) {
children.push({type: 'text', value: comment});
}
} else {
base += '#';
children.push({type: 'inlineCode', value: abbr(link.reference)});
children = [{
type: 'text',
value: base + abbr(link.reference) + comment
}];
if (link.comment) {
children.push({type: 'text', value: comment});
}
} else {
base += '#';
node.children = children;
});
children = [{
type: 'text',
value: base + abbr(link.reference) + comment
}];
}
node.children = children;
}
}
{
"name": "remark-github",
"version": "7.0.1",
"version": "7.0.2",
"description": "Auto-link references like in GitHub issues, PRs, and comments",

@@ -19,3 +19,3 @@ "license": "MIT",

],
"repository": "https://github.com/wooorm/remark-github",
"repository": "wooorm/remark-github",
"bugs": "https://github.com/wooorm/remark-github/issues",

@@ -26,2 +26,6 @@ "author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)",

],
"files": [
"index.js",
"lib"
],
"dependencies": {

@@ -34,6 +38,2 @@ "is-alphabetical": "^1.0.0",

},
"files": [
"index.js",
"lib"
],
"devDependencies": {

@@ -43,4 +43,4 @@ "browserify": "^14.0.0",

"nyc": "^11.0.2",
"remark": "^7.0.0",
"remark-cli": "^3.0.0",
"remark": "^8.0.0",
"remark-cli": "^4.0.0",
"remark-preset-wooorm": "^3.0.0",

@@ -47,0 +47,0 @@ "tape": "^4.4.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc