dtao / console-highlight Goto Github PK
View Code? Open in Web Editor NEWSyntax highlighting in the console
Syntax highlighting in the console
/home/abhisekp/MyProjects/NodeApp/md-urls/node_modules/bail/index.js:28
throw err;
^
TypeError: Cannot set property length of [object Object] which has only a getter
at [object Object].core.Node.insertBefore (/home/abhisekp/MyProjects/NodeApp/md-urls/node_modules/jsdom/lib/jsdom/level1/core.js:553:30)
at [object Object].<anonymous> (/home/abhisekp/MyProjects/NodeApp/md-urls/node_modules/jsdom/lib/jsdom/level2/events.js:332:20)
at [object Object].proto.(anonymous function) [as insertBefore] (/home/abhisekp/MyProjects/NodeApp/md-urls/node_modules/jsdom/lib/jsdom/utils.js:23:26)
at [object Object].core.Node.appendChild (/home/abhisekp/MyProjects/NodeApp/md-urls/node_modules/jsdom/lib/jsdom/level1/core.js:671:17)
at [object Object].textContent (/home/abhisekp/MyProjects/NodeApp/md-urls/node_modules/jsdom/lib/jsdom/level3/core.js:187:10)
at /home/abhisekp/MyProjects/NodeApp/md-urls/node_modules/htmlout/htmlout.js:94:27
at Array.forEach (native)
at htmlout (/home/abhisekp/MyProjects/NodeApp/md-urls/node_modules/htmlout/htmlout.js:92:15)
at htmlout (/home/abhisekp/MyProjects/NodeApp/md-urls/node_modules/htmlout/htmlout.js:116:12)
at consoleHighlight (/home/abhisekp/MyProjects/NodeApp/md-urls/node_modules/console-highlight/consoleHighlight.js:20:10)
import highlight from 'console-highlight';
console.log(highlight('// what the hell'));
I performed these steps:
git clone https://github.com/dtao/console-highlight.git
cd console-highlight
npm install
node test.js
And this is my output:
/path/to/console-highlight/node_modules/jsdom/lib/jsdom/level1/core.js:553
Array.prototype.splice.call(this._childNodes, refChildIndex, 0, newChild);
^
TypeError: Cannot set property length of [object Object] which has only a getter
at core.Node.insertBefore (/path/to/console-highlight/node_modules/jsdom/lib/jsdom/level1/core.js:553:30)
at null.<anonymous> (/path/to/console-highlight/node_modules/jsdom/lib/jsdom/level2/events.js:332:20)
at proto.(anonymous function) [as insertBefore] (/path/to/console-highlight/node_modules/jsdom/lib/jsdom/utils.js:23:26)
at core.Node.appendChild (/path/to/console-highlight/node_modules/jsdom/lib/jsdom/level1/core.js:671:17)
at null.textContent (/path/to/console-highlight/node_modules/jsdom/lib/jsdom/level3/core.js:187:10)
at /path/to/console-highlight/node_modules/htmlout/htmlout.js:94:27
at Array.forEach (native)
at htmlout (/path/to/console-highlight/node_modules/htmlout/htmlout.js:92:15)
at htmlout (/path/to/console-highlight/node_modules/htmlout/htmlout.js:116:12)
at consoleHighlight (/path/to/console-highlight/consoleHighlight.js:20:10)
What's going wrong?
It would be a really nice tool to use from the command line. The usage could be:
highlight [-l language] [-t theme] file
if file is omitted, it could take input from stdin. So, for example, this would be possible:
cat file.js | highlight -l 'javascript' -t 'solarized_dark'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.