New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

documentary

Package Overview
Dependencies
Maintainers
1
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

documentary - npm Package Compare versions

Comparing version 1.4.0 to 1.4.1

30

build/bin/index.js

@@ -8,3 +8,3 @@ #!/usr/bin/env node

var _wrote = require("wrote");
var _pedantry = _interopRequireDefault(require("pedantry"));

@@ -15,4 +15,2 @@ var _util = require("util");

var _dirStream = _interopRequireDefault(require("../lib/dir-stream"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -42,3 +40,3 @@

const doc = async (source, output, toc) => {
const doc = async (source, output, justToc = false) => {
if (!source) {

@@ -50,22 +48,12 @@ console.log('Please specify an input file.'); // print usage

const ls = (0, _fs.lstatSync)(source);
let stream;
try {
const {
content
} = await (0, _wrote.readDirStructure)(source);
stream = (0, _dirStream.default)(source, content);
} catch (err) {
const {
code
} = err;
if (code == 'ENOTDIR') {
stream = (0, _fs.createReadStream)(source);
} else {
throw err;
}
if (ls.isDirectory()) {
stream = new _pedantry.default(source);
} else if (ls.isFile()) {
stream = (0, _fs.createReadStream)(source);
}
await (0, _run.default)(stream, output, toc);
await (0, _run.default)(stream, output, justToc);
};

@@ -82,3 +70,3 @@

if (code == 'ENOENT') {
console.log('File %s does not exist', _source);
console.log('File %s does not exist.', _source);
process.exit(2);

@@ -85,0 +73,0 @@ }

@@ -32,7 +32,7 @@ "use strict";

* @param {string} [out] Path to the output file.
* @param {boolean} [toc] Just print the TOC.
* @param {boolean} [justToc] Just print the TOC.
*/
async function run(stream, out, toc) {
async function run(stream, out, justToc) {
const pt = new _stream.PassThrough();

@@ -43,3 +43,3 @@ pt.pause();

if (toc) {
if (justToc) {
console.log(t);

@@ -46,0 +46,0 @@ process.exit();

@@ -6,3 +6,3 @@ "use strict";

});
exports.commentRule = exports.createTocRule = exports.badgeRule = void 0;
exports.commentRule = exports.codeRe = exports.commentRe = exports.createTocRule = exports.badgeRule = void 0;

@@ -30,4 +30,8 @@ var _util = require("util");

exports.createTocRule = createTocRule;
const commentRe = /<!--[\s\S]*?-->\n*/g;
exports.commentRe = commentRe;
const codeRe = /```(\w+\n)?[\s\S]*?\n```/g;
exports.codeRe = codeRe;
const commentRule = {
re: /<!--[\s\S]*?-->\n*/g,
re: commentRe,

@@ -34,0 +38,0 @@ replacement() {

@@ -16,2 +16,4 @@ "use strict";

var _rules = require("./rules");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -37,5 +39,18 @@

let res;
const matches = [];
const b = `${buffer}`.replace(new RegExp(_rules.commentRe, 'g'), '').replace(new RegExp(_methodTitle.methodTitleRe, 'g'), match => {
matches.push(match);
return match;
}).replace(new RegExp(_rules.codeRe, 'g'), match => {
const isMatch = _methodTitle.methodTitleRe.test(match);
if (isMatch) {
return matches.shift();
}
return '';
});
const rre = new RegExp(`(?:${re.source})|(?:${_methodTitle.methodTitleRe.source})`, 'g');
while ((res = rre.exec(buffer)) !== null) {
while ((res = rre.exec(b)) !== null) {
let t;

@@ -42,0 +57,0 @@ let level;

@@ -0,1 +1,8 @@

## 21 June 2018
### 1.4.1
- [fix] skip titles from code blocks and comments for Table Of Contents generation.
- [dep] switch from `dir-stream` to `Pedantry`.
## 20 June 2018

@@ -2,0 +9,0 @@

{
"name": "documentary",
"version": "1.4.0",
"version": "1.4.1",
"description": "A library to manage documentation, such as README, usage, man pages and changelog.",

@@ -58,2 +58,3 @@ "main": "build",

"catchment": "2.0.1",
"pedantry": "1.0.0",
"restream": "2.1.0",

@@ -60,0 +61,0 @@ "spawncommand": "2.0.1",

@@ -27,4 +27,2 @@ # documentary

* [Examples Placement](#examples-placement)
- [API Method](#api-method)
- [API Method](#api-method)
- [CLI](#cli)

@@ -74,3 +72,3 @@ - [API](#api)

Table of contents are useful for navigation the README document. When a `%TOC%` placeholder is found in the file, it will be replaced with an extracted structure.
Table of contents are useful for navigation the README document. When a `%TOC%` placeholder is found in the file, it will be replaced with an extracted structure. Titles appearing in comments and code blocks will be skipped.

@@ -77,0 +75,0 @@ ```md

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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