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

glob-docs

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

glob-docs - npm Package Compare versions

Comparing version 0.0.12-alpha to 0.0.13-alpha

src/doctags/block.js

2

package.json
{
"name": "glob-docs",
"version": "0.0.12-alpha",
"version": "0.0.13-alpha",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -18,2 +18,3 @@ /*!

CODE: require('./doctags/code'),
BLOCK: require('./doctags/block'),
OPT: require('./doctags/option'),

@@ -20,0 +21,0 @@ OPTION: require('./doctags/option'),

@@ -29,3 +29,50 @@ function createLink(childTag, label, options) {

OPT: OPTION, // options alias
BLOCK: ({ options, docTag }) => {
let fileLink = '';
if (options.code.showSourceFile && docTag.options.showSourceFile) {
let sourceLabel = [
docTag.node.relativeFilepath,
docTag.node.lineNum
].join(':');
fileLink = `<sub>File: ${createLink(docTag, sourceLabel, options)}</sub>\n`;
}
if (docTag.options.autoIndent) {
let sourceLines = docTag.metatags.codeSource.split('\n');
let count = 0;
let stripIndentCount = null;
for(const lineIndex in sourceLines) {
const sourceLine = sourceLines[lineIndex];
// no point to iterate white lines
if (sourceLine.trim() === "") {
continue;
};
for (const charIndex in sourceLine) {
const character = sourceLine[charIndex];
if (character === " ") {
count++;
} else {
break;
}
}
if (stripIndentCount === null || count < stripIndentCount) {
stripIndentCount = count;
}
}
const newLines = [];
for(const lineIndex in sourceLines) {
const sourceLine = sourceLines[lineIndex];
newLines.push(sourceLine.slice(stripIndentCount, sourceLine.length));
}
docTag.metatags.codeSource = newLines.join('\n');
}
return fileLink + [
docTag.metatags.codeSource,
].join('\n');
},
/***

@@ -97,3 +144,3 @@ * It renders syntax highligh code.

let todoLine = `- ${splitted[0]}] - [${splitted[1]}](${sourceLink}#L${docTag.node.lineNum})`;
let todoLine = `- ${splitted[0]}] - [${splitted[1]}](${sourceLink}#lines-${docTag.node.lineNum})`;
todoLine = todoLine.replace('[]', '[ ]'); // normalize brackets

@@ -100,0 +147,0 @@ return todoLine;

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