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

marked-terminal

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

marked-terminal - npm Package Compare versions

Comparing version 1.6.2 to 1.7.0

39

index.js

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

var TAB_ALLOWED_CHARACTERS = ['\t'];
// HARD_RETURN holds a character sequence used to indicate text has a

@@ -47,2 +49,3 @@ // hard (no-reflowing) line break. Previously \r and \r\n were turned

reflowText: false,
tab: 3,
tableOptions: {}

@@ -53,2 +56,3 @@ };

this.o = assign({}, defaultOptions, options);
this.tab = sanitizeTab(this.o.tab, defaultOptions.tab);
this.tableSettings = this.o.tableOptions;

@@ -79,7 +83,7 @@ this.emoji = this.o.emoji ? insertEmojis : identity;

Renderer.prototype.code = function(code, lang, escaped) {
return '\n' + indentify(highlight(code, lang, this.o, this.highlightOptions)) + '\n\n';
return '\n' + indentify(highlight(code, lang, this.o, this.highlightOptions), this.tab) + '\n\n';
};
Renderer.prototype.blockquote = function(quote) {
return '\n' + this.o.blockquote(indentify(quote.trim())) + '\n\n';
return '\n' + this.o.blockquote(indentify(quote.trim(), this.tab)) + '\n\n';
};

@@ -111,3 +115,3 @@

Renderer.prototype.list = function(body, ordered) {
body = indentLines(this.o.listitem(body));
body = indentLines(this.o.listitem(body), this.tab);
if (!ordered) return body;

@@ -237,4 +241,4 @@ return changeToOrdered(body);

function indentLines (text) {
return text.replace(/\n/g, '\n' + tab()) + '\n\n';
function indentLines (text, tab) {
return text.replace(/\n/g, '\n' + tab) + '\n\n';
}

@@ -280,7 +284,2 @@

function tab(size) {
size = size || 4;
return (new Array(size)).join(' ');
}
function undoColon (str) {

@@ -290,5 +289,5 @@ return str.replace(COLON_REPLACER_REGEXP, ':');

function indentify(text) {
function indentify(text, tab) {
if (!text) return text;
return tab() + text.split('\n').join('\n' + tab());
return tab + text.split('\n').join('\n' + tab);
}

@@ -338,1 +337,17 @@

}
function isAllowedTabString (string) {
return TAB_ALLOWED_CHARACTERS.some(function (char) {
return string.match('^('+char+')+$');
});
}
function sanitizeTab (tab, fallbackTab) {
if (typeof tab === 'number') {
return (new Array(tab + 1)).join(' ');
} else if (typeof tab === 'string' && isAllowedTabString(tab)) {
return tab;
} else {
return (new Array(fallbackTab + 1)).join(' ');
}
}
{
"name": "marked-terminal",
"version": "1.6.2",
"version": "1.7.0",
"description": "A custom render for marked to output to the Terminal",

@@ -26,6 +26,6 @@ "main": "index.js",

"cardinal": "^1.0.0",
"chalk": "^1.0.0",
"chalk": "^1.1.3",
"cli-table": "^0.3.1",
"lodash.assign": "^4.2.0",
"node-emoji": "^1.3.1"
"node-emoji": "^1.4.1"
},

@@ -36,4 +36,4 @@ "directories": {

"devDependencies": {
"marked": "^0.3.3",
"mocha": "^3.0.2"
"marked": "^0.3.6",
"mocha": "^3.1.2"
},

@@ -40,0 +40,0 @@ "repository": {

@@ -100,3 +100,3 @@ marked-terminal

// Wheter or not to undo marked escaping
// Whether or not to undo marked escaping
// of enitities (" -> " etc)

@@ -109,3 +109,6 @@ unescape: true,

// Options passed to cli-table
tableOptions: {}
tableOptions: {},
// The size of tabs in number of spaces or as tab characters
tab: 3 // examples: 4, 2, \t, \t\t
};

@@ -112,0 +115,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