marked-terminal
Advanced tools
Comparing version 3.1.1 to 3.2.0
20
index.js
@@ -5,6 +5,8 @@ "use strict"; | ||
var Table = require('cli-table'); | ||
var assign = require('lodash.assign'); | ||
var cardinal = require('cardinal'); | ||
var emoji = require('node-emoji'); | ||
const ansiEscapes = require('ansi-escapes'); | ||
const supportsHyperlinks = require('supports-hyperlinks'); | ||
var TABLE_CELL_SPLIT = '^*||*^'; | ||
@@ -55,3 +57,3 @@ var TABLE_ROW_WRAP = '*|*|*|*'; | ||
function Renderer(options, highlightOptions) { | ||
this.o = assign({}, defaultOptions, options); | ||
this.o = Object.assign({}, defaultOptions, options); | ||
this.tab = sanitizeTab(this.o.tab, defaultOptions.tab); | ||
@@ -141,3 +143,3 @@ this.tableSettings = this.o.tableOptions; | ||
Renderer.prototype.table = function(header, body) { | ||
var table = new Table(assign({}, { | ||
var table = new Table(Object.assign({}, { | ||
head: generateTableRow(header)[0] | ||
@@ -200,6 +202,10 @@ }, this.tableSettings)); | ||
var out = ''; | ||
if (hasText) out += this.emoji(text) + ' ('; | ||
out += this.o.href(href); | ||
if (hasText) out += ')'; | ||
if (supportsHyperlinks.stdout) { | ||
out = ansiEscapes.link(text?this.emoji(text):href, href); | ||
}else{ | ||
if (hasText) out += this.emoji(text) + ' ('; | ||
out += this.o.href(href); | ||
if (hasText) out += ')'; | ||
} | ||
return this.o.link(out); | ||
@@ -334,3 +340,3 @@ }; | ||
'((?:' + indent + ')+)' + // Indentation of sub point | ||
'(' + POINT_REGEX + '(?:.*)+)$', 'm'); // Body of subpoint | ||
'(' + POINT_REGEX + '(?:.*)+)$', 'gm'); // Body of subpoint | ||
return body.replace(regex, '$1\n' + indent + '$2$3'); | ||
@@ -337,0 +343,0 @@ } |
{ | ||
"name": "marked-terminal", | ||
"version": "3.1.1", | ||
"version": "3.2.0", | ||
"description": "A custom render for marked to output to the Terminal", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "mocha tests/*.js --reporter spec" | ||
"test": "FORCE_HYPERLINK=0 mocha tests/*.js --reporter spec" | ||
}, | ||
@@ -22,10 +22,11 @@ "files": [ | ||
"peerDependencies": { | ||
"marked": "^0.4.0 || ^0.5.0" | ||
"marked": "^0.4.0 || ^0.5.0 || ^0.6.0" | ||
}, | ||
"dependencies": { | ||
"ansi-escapes": "^3.1.0", | ||
"cardinal": "^2.1.1", | ||
"chalk": "^2.4.1", | ||
"cli-table": "^0.3.1", | ||
"lodash.assign": "^4.2.0", | ||
"node-emoji": "^1.4.1" | ||
"node-emoji": "^1.4.1", | ||
"supports-hyperlinks": "^1.0.1" | ||
}, | ||
@@ -36,3 +37,3 @@ "directories": { | ||
"devDependencies": { | ||
"marked": "^0.5.0", | ||
"marked": "^0.6.0", | ||
"mocha": "^5.2.0" | ||
@@ -39,0 +40,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18415
404
7
+ Addedansi-escapes@^3.1.0
+ Addedsupports-hyperlinks@^1.0.1
+ Addedansi-escapes@3.2.0(transitive)
+ Addedhas-flag@2.0.0(transitive)
+ Addedmarked@0.6.3(transitive)
+ Addedsupports-hyperlinks@1.0.1(transitive)
- Removedlodash.assign@^4.2.0
- Removedlodash.assign@4.2.0(transitive)
- Removedmarked@0.5.2(transitive)