Socket
Socket
Sign inDemoInstall

marked-terminal

Package Overview
Dependencies
Maintainers
1
Versions
34
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 7.0.0 to 7.1.0

125

index.js

@@ -77,3 +77,10 @@ 'use strict';

Renderer.prototype.space = function () {
return '';
};
Renderer.prototype.text = function (text) {
if (typeof text === 'object') {
text = text.text;
}
return this.o.text(text);

@@ -83,2 +90,7 @@ };

Renderer.prototype.code = function (code, lang, escaped) {
if (typeof code === 'object') {
lang = code.lang;
escaped = !!code.escaped;
code = code.text;
}
return section(

@@ -90,2 +102,5 @@ indentify(this.tab, highlight(code, lang, this.o, this.highlightOptions))

Renderer.prototype.blockquote = function (quote) {
if (typeof quote === 'object') {
quote = this.parser.parse(quote.tokens);
}
return section(this.o.blockquote(indentify(this.tab, quote.trim())));

@@ -95,6 +110,13 @@ };

Renderer.prototype.html = function (html) {
if (typeof html === 'object') {
html = html.text;
}
return this.o.html(html);
};
Renderer.prototype.heading = function (text, level, raw) {
Renderer.prototype.heading = function (text, level) {
if (typeof text === 'object') {
level = text.depth;
text = this.parser.parseInline(text.tokens);
}
text = this.transform(text);

@@ -119,2 +141,13 @@

Renderer.prototype.list = function (body, ordered) {
if (typeof body === 'object') {
const listToken = body;
const start = listToken.start;
const loose = listToken.loose;
ordered = listToken.ordered;
body = '';
for (let j = 0; j < listToken.items.length; j++) {
body += this.listitem(listToken.items[j]);
}
}
body = this.o.list(body, ordered, this.tab);

@@ -125,2 +158,27 @@ return section(fixNestedLists(indentLines(this.tab, body), this.tab));

Renderer.prototype.listitem = function (text) {
if (typeof text === 'object') {
const item = text;
text = '';
if (item.task) {
const checkbox = this.checkbox({ checked: !!item.checked });
if (item.loose) {
if (item.tokens.length > 0 && item.tokens[0].type === 'paragraph') {
item.tokens[0].text = checkbox + ' ' + item.tokens[0].text;
if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') {
item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text;
}
} else {
item.tokens.unshift({
type: 'text',
raw: checkbox + ' ',
text: checkbox + ' '
});
}
} else {
text += checkbox + ' ';
}
}
text += this.parser.parse(item.tokens, !!item.loose);
}
var transform = compose(this.o.listitem, this.transform);

@@ -135,2 +193,5 @@ var isNested = text.indexOf('\n') !== -1;

Renderer.prototype.checkbox = function (checked) {
if (typeof checked === 'object') {
checked = checked.checked;
}
return '[' + (checked ? 'X' : ' ') + '] ';

@@ -140,2 +201,5 @@ };

Renderer.prototype.paragraph = function (text) {
if (typeof text === 'object') {
text = this.parser.parseInline(text.tokens);
}
var transform = compose(this.o.paragraph, this.transform);

@@ -150,2 +214,26 @@ text = transform(text);

Renderer.prototype.table = function (header, body) {
if (typeof header === 'object') {
const token = header;
header = '';
// header
let cell = '';
for (let j = 0; j < token.header.length; j++) {
cell += this.tablecell(token.header[j]);
}
header += this.tablerow({ text: cell });
body = '';
for (let j = 0; j < token.rows.length; j++) {
const row = token.rows[j];
cell = '';
for (let k = 0; k < row.length; k++) {
cell += this.tablecell(row[k]);
}
body += this.tablerow({ text: cell });
}
if (body) body = `<tbody>${body}</tbody>`;
}
var table = new Table(

@@ -168,6 +256,12 @@ Object.assign(

Renderer.prototype.tablerow = function (content) {
if (typeof content === 'object') {
content = content.text;
}
return TABLE_ROW_WRAP + content + TABLE_ROW_WRAP + '\n';
};
Renderer.prototype.tablecell = function (content, flags) {
Renderer.prototype.tablecell = function (content) {
if (typeof content === 'object') {
content = this.parser.parseInline(content.tokens);
}
return content + TABLE_CELL_SPLIT;

@@ -178,2 +272,5 @@ };

Renderer.prototype.strong = function (text) {
if (typeof text === 'object') {
text = this.parser.parseInline(text.tokens);
}
return this.o.strong(text);

@@ -183,2 +280,5 @@ };

Renderer.prototype.em = function (text) {
if (typeof text === 'object') {
text = this.parser.parseInline(text.tokens);
}
text = fixHardReturn(text, this.o.reflowText);

@@ -189,2 +289,5 @@ return this.o.em(text);

Renderer.prototype.codespan = function (text) {
if (typeof text === 'object') {
text = text.text;
}
text = fixHardReturn(text, this.o.reflowText);

@@ -199,2 +302,5 @@ return this.o.codespan(text.replace(/:/g, COLON_REPLACER));

Renderer.prototype.del = function (text) {
if (typeof text === 'object') {
text = this.parser.parseInline(text.tokens);
}
return this.o.del(text);

@@ -204,2 +310,8 @@ };

Renderer.prototype.link = function (href, title, text) {
if (typeof href === 'object') {
title = href.title;
text = this.parser.parseInline(href.tokens);
href = href.href;
}
if (this.options.sanitize) {

@@ -239,2 +351,8 @@ try {

Renderer.prototype.image = function (href, title, text) {
if (typeof href === 'object') {
title = href.title;
text = href.text;
href = href.href;
}
if (typeof this.o.image === 'function') {

@@ -280,2 +398,3 @@ return this.o.image(href, title, text);

r.options = this.options;
r.parser = this.parser;
return r[func](...args);

@@ -285,3 +404,3 @@ };

},
{ renderer: {} }
{ renderer: {}, useNewRenderer: true }
);

@@ -288,0 +407,0 @@ }

16

package.json
{
"name": "marked-terminal",
"version": "7.0.0",
"version": "7.1.0",
"description": "A custom render for marked to output to the Terminal",

@@ -37,9 +37,9 @@ "main": "./index.cjs",

"peerDependencies": {
"marked": ">=1 <13"
"marked": ">=1 <14"
},
"dependencies": {
"ansi-escapes": "^6.2.0",
"ansi-escapes": "^7.0.0",
"chalk": "^5.3.0",
"cli-highlight": "^2.1.11",
"cli-table3": "^0.6.3",
"cli-table3": "^0.6.5",
"node-emoji": "^2.1.3",

@@ -52,8 +52,8 @@ "supports-hyperlinks": "^3.0.0"

"devDependencies": {
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-node-resolve": "^15.2.3",
"cross-env": "^7.0.3",
"marked": "^12.0.0",
"mocha": "^10.2.0",
"rollup": "^4.9.6"
"marked": "^13.0.0",
"mocha": "^10.4.0",
"rollup": "^4.18.0"
},

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

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