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

remark-usage

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark-usage - npm Package Compare versions

Comparing version 4.0.1 to 5.0.0

78

index.js

@@ -1,9 +0,1 @@

/**
* @author Titus Wormer
* @copyright 2015 Titus Wormer
* @license MIT
* @module remark:usage
* @fileoverview Add a usage example to your README.
*/
'use strict';

@@ -19,5 +11,7 @@

var cept = require('cept');
var unified = require('unified');
var markdown = require('remark-parse');
/* Expose `attacher`. */
module.exports = attacher;
module.exports = usage;

@@ -31,2 +25,4 @@ /* Methods. */

var processor = unified().use(markdown);
/* List of locations to look for an example. */

@@ -49,11 +45,4 @@ var EXAMPLES = [

/**
* Post-process the example document.
*
* @param {string} value - Content to process.
* @param {Object} logs - List of logs.
* @param {Object} options - Configuration.
* @return {Array.<Node>} - List of mdast nodes.
*/
function postprocess(value, logs, options, processor) {
/* Post-process the example document. */
function postprocess(value, logs, options) {
var tokens = [];

@@ -105,3 +94,3 @@ var start = 0;

if (token.type === 'markdown') {
markdown = markdown.concat(parse(token.value, processor));
markdown = markdown.concat(parse(token.value));
} else {

@@ -136,10 +125,4 @@ prev = markdown[markdown.length - 1];

/**
* Adds an npm version badge to the main heading,
* when available.
*
* @param {Unified} processor - Instance
* @param {Object?} options - Configuration.
*/
function attacher(processor, options) {
/* Update the example section. */
function usage(options) {
var settings = {};

@@ -195,22 +178,13 @@ var pack;

return function (tree) {
heading(tree, header, runFactory(settings, processor));
heading(tree, header, runFactory(settings));
};
}
/**
* Construct a transformer based on `options`.
*
* @param {Object} options - Configuration.
* @return {function(node)} - Bound heading-range callback.
*/
function runFactory(options, processor) {
/**
* Adds an example section based on a valid example
* JavaScript document to a `Usage` section.
*
* @param {Node} start - Starting heading.
* @param {Array.<Node>} nodes - Content.
* @param {Node} end - Ending heading.
*/
return function (start, nodes, end) {
/* Construct a transformer based on `options`. */
function runFactory(options) {
return run;
/* Add an example section based on a valid example
* JavaScript document to a `Usage` section. */
function run(start, nodes, end) {
var logs = {};

@@ -270,17 +244,11 @@ var example;

return [start].concat(
postprocess(source, logs, options, processor),
postprocess(source, logs, options),
end
);
};
}
}
/**
* Transform a script into an intermediate nodes,
/* Transform a script into an intermediate nodes,
* removes the IDs from `console.log` invocations,
* and resolves the main `require` call.
*
* @param {string} source - Scripts source.
* @param {Object} options - Configuration.
* @return {Array.<Object>} - List of tokens.
*/
* and resolves the main `require` call. */
function script(source, options) {

@@ -340,3 +308,3 @@ var tokens;

* information. */
function parse(value, processor) {
function parse(value) {
return processor.parse(value, {position: false}).children;

@@ -343,0 +311,0 @@ }

{
"name": "remark-usage",
"version": "4.0.1",
"version": "5.0.0",
"description": "Add a usage example to your README",

@@ -24,4 +24,6 @@ "license": "MIT",

"mdast-util-heading-range": "^2.0.0",
"remark-parse": "^3.0.0",
"require-uncached": "^1.0.2",
"trim-trailing-lines": "^1.0.0",
"unified": "^6.0.0",
"unquote": "^1.1.0"

@@ -32,11 +34,11 @@ },

"negate": "^1.0.0",
"nyc": "^8.1.0",
"remark": "^6.0.0",
"remark-cli": "^2.0.0",
"remark-preset-wooorm": "^1.0.0",
"nyc": "^10.0.0",
"remark": "^7.0.0",
"remark-cli": "^3.0.0",
"remark-preset-wooorm": "^2.0.0",
"tape": "^4.0.0",
"xo": "^0.16.0"
"xo": "^0.17.1"
},
"scripts": {
"build-md": "remark *.md --quiet --frail",
"build-md": "remark *.md -qfo",
"build": "npm run build-md",

@@ -58,3 +60,4 @@ "lint": "xo",

"max-lines": "off",
"no-cond-assign": "off"
"no-cond-assign": "off",
"import/no-dynamic-require": "off"
},

@@ -67,10 +70,8 @@ "ignore": [

"output": true,
"presets": "wooorm",
"plugins": {
"./": null,
"lint": {
"fenced-code-flag": false
}
}
"plugins": [
"preset-wooorm",
["remark-lint-fenced-code-flag", false],
"./"
]
}
}
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