-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎉 Plugin is working again, reverted some changes to gulpfile for brow…
…serify * Separated strip and colorize (colorize ain't working yet) * Strip will run on button click only now * Readme now has some really working instructions (closes #2) * Upgraded most of the plugins using npm-check ✌️
- Loading branch information
Showing
6 changed files
with
80 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,9 @@ | ||
'use strict'; | ||
|
||
// this is executed at every page load, would be nice to detect ansi chars and colorize here ;) | ||
|
||
// @see https://github.com/hughsk/ansi-html-stream | ||
var ansi = require('ansi-html-stream'); | ||
var stripAnsi = require('strip-ansi'); | ||
|
||
var fs = require('fs'); | ||
|
||
var stream = ansi({chunked: false}); | ||
|
||
// todo: find a way to get document.body.textContent as stream | ||
//console.log(document.body.textContent); | ||
|
||
// todo: move this to a button or submenu, whatever. at least this works | ||
document.body.innerText = stripAnsi(document.body.textContent); | ||
|
||
// pip document to ansi stream | ||
//documentAsStream = getDocumentAsStream(); | ||
//documentAsStream.pipe(stream); | ||
|
||
// this should be the current page | ||
var file = fs.createWriteStream('output.html', 'utf8'); | ||
|
||
stream.pipe(file, {end: false}); | ||
stream.once('end', function () { | ||
file.end('</pre>\n'); | ||
}); | ||
file.write('<pre>\n'); | ||
|
||
|
||
//documentAsStream.on('data', function (data) { | ||
// // not quite sure if I'll need to do something here | ||
// // I think pipe is the magic part here | ||
// }) | ||
// .pipe(stream) | ||
// .on('close', function () { | ||
// console.log('stream is over'); | ||
// stream.end(null) | ||
// }); | ||
|
||
console.log('todo: locate and colorize ANSI things!'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
'use strict'; | ||
|
||
// This is currently called on extension button click | ||
|
||
// @see https://github.com/hughsk/ansi-html-stream | ||
var ansi = require('ansi-html-stream'); | ||
var stripAnsi = require('strip-ansi'); | ||
|
||
// var fs = require('fs'); | ||
|
||
var stream = ansi({chunked: false}); | ||
|
||
// the only thing that currently work | ||
// We get the document and strip ansi content :) | ||
console.log('About to strip ANSI characters!'); | ||
document.body.innerText = stripAnsi(document.body.textContent); | ||
console.log('Done!'); | ||
|
||
// todo: find a way to get document.body.textContent as stream | ||
|
||
// pipe document to ansi stream | ||
//documentAsStream = getDocumentAsStream(); | ||
//documentAsStream.pipe(stream); | ||
|
||
// this should be the current page | ||
// var file = fs.createWriteStream('output.html', 'utf8'); | ||
// | ||
// stream.pipe(file, {end: false}); | ||
// stream.once('end', function () { | ||
// file.end('</pre>\n'); | ||
// }); | ||
// file.write('<pre>\n'); | ||
|
||
|
||
//documentAsStream.on('data', function (data) { | ||
// // not quite sure if I'll need to do something here | ||
// // I think pipe is the magic part here | ||
// }) | ||
// .pipe(stream) | ||
// .on('close', function () { | ||
// console.log('stream is over'); | ||
// stream.end(null) | ||
// }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters