Huge News!Announcing our $40M Series B led by Abstract Ventures.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.1 to 1.4.2

19

build/lib/index.js

@@ -6,4 +6,10 @@ "use strict";

});
exports.getLink = void 0;
exports.exactMethodTitle = exports.exactTable = exports.makeARegexFromRule = exports.getLink = void 0;
var _table = _interopRequireDefault(require("./rules/table"));
var _methodTitle = _interopRequireDefault(require("./rules/method-title"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const getLink = title => {

@@ -15,2 +21,13 @@ const l = title.replace(/<br\/>/g, '').replace(/&nbsp;/g, '').replace(/[^\w-\d ]/g, '').toLowerCase().replace(/[, ]/g, '-');

exports.getLink = getLink;
const makeARegexFromRule = rule => {
const re = new RegExp(`^${rule.re.source}`);
return re;
};
exports.makeARegexFromRule = makeARegexFromRule;
const exactTable = makeARegexFromRule(_table.default);
exports.exactTable = exactTable;
const exactMethodTitle = makeARegexFromRule(_methodTitle.default);
exports.exactMethodTitle = exactMethodTitle;
//# sourceMappingURL=index.js.map

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

var _lib = require("../lib");
var _table = _interopRequireDefault(require("./rules/table"));

@@ -23,5 +25,26 @@

const tocRule = (0, _rules.createTocRule)(toc);
const s = new _restream.Replaceable([_rules.commentRule, tocRule, _rules.badgeRule, _table.default, _methodTitle.default, _example.default]);
const codeBlocks = [];
const marker = `%%_DOCUMENTARY_REPLACEMENT_${Date.now()}_%%`;
const s = new _restream.Replaceable([_rules.commentRule, {
re: new RegExp(_rules.codeRe, 'g'),
replacement(match) {
if (_lib.exactTable.test(match) || _lib.exactMethodTitle.test(match)) {
return match;
}
codeBlocks.push(match);
return marker;
}
}, tocRule, _rules.badgeRule, _table.default, _methodTitle.default, _example.default, {
re: new RegExp(marker, 'g'),
replacement() {
return codeBlocks.shift();
}
}]);
return s;
}
//# sourceMappingURL=replace-stream.js.map

2

build/lib/rules/index.js

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

exports.commentRe = commentRe;
const codeRe = /```(\w+\n)?[\s\S]*?\n```/g;
const codeRe = /```(`)?(\w+\n)?[\s\S]*?\n```\1/g;
exports.codeRe = codeRe;

@@ -34,0 +34,0 @@ const commentRule = {

@@ -21,2 +21,5 @@ "use strict";

const re = /(?:^|\n) *(#+) *((?:(?!\n)[\s\S])+)\n/;
const rre = (0, _.makeARegexFromRule)({
re
});

@@ -39,18 +42,12 @@ class Toc extends _stream.Transform {

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();
const b = `${buffer}`.replace(new RegExp(_rules.commentRe, 'g'), '').replace(new RegExp(_rules.codeRe, 'g'), match => {
if (_.exactMethodTitle.test(match) || rre.test(match)) {
return match;
}
return '';
return ''; // ignore code blocks
});
const rre = new RegExp(`(?:${re.source})|(?:${_methodTitle.methodTitleRe.source})`, 'g');
const superRe = new RegExp(`(?:${re.source})|(?:${_methodTitle.methodTitleRe.source})`, 'g');
while ((res = rre.exec(b)) !== null) {
while ((res = superRe.exec(b)) !== null) {
let t;

@@ -74,3 +71,3 @@ let level;

level = l.length;
const b = res.slice(4, 6).filter(a => a).join(' ').trim();
const bb = res.slice(4, 6).filter(a => a).join(' ').trim();
const json = res[7] || '[]';

@@ -84,3 +81,3 @@ const args = JSON.parse(json);

link = (0, _.getLink)(fullTitle);
t = `\`${b}(${s.join(', ')})${res[6] ? `: ${res[6]}` : ''}\``;
t = `\`${bb}(${s.join(', ')})${res[6] ? `: ${res[6]}` : ''}\``;
} catch (err) {

@@ -87,0 +84,0 @@ // ok

## 21 June 2018
### 1.4.2
- [fix] don't process code blocks for titles and other transforms.
- [doc] build with properly escaped examples of `md` source code for method-title generation.
### 1.4.1

@@ -4,0 +9,0 @@

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

@@ -5,0 +5,0 @@ "main": "build",

@@ -85,3 +85,3 @@ # documentary

````m
```tаble
```table
[

@@ -101,3 +101,2 @@ ["arg", "description"],

| -z | A list of zones to check |
### Method Title

@@ -112,3 +111,3 @@

````m
```#️⃣#️⃣#️⃣#️⃣ async runSoftware => string
```#### async runSoftware => string
[

@@ -131,3 +130,3 @@ ["path", "string"],

````m
```#️⃣#️⃣#️⃣#️⃣ async runSoftware => string
```#### async runSoftware
[

@@ -144,3 +143,3 @@ ["path", "string"]

````m
```#️⃣#️⃣#️⃣#️⃣ async runSoftware => string
```#### runSoftware => string
```

@@ -147,0 +146,0 @@ ````

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