From 22c486a16b091f27f999afa92a75d8a45e615ae1 Mon Sep 17 00:00:00 2001 From: PhilKunz Date: Tue, 2 Feb 2016 14:49:08 +0100 Subject: [PATCH] update to hlight --- index.js | 1 - package.json | 2 +- ts/beautylog.node.code.ts | 26 +++----------------------- 3 files changed, 4 insertions(+), 25 deletions(-) diff --git a/index.js b/index.js index 4e6ea42..165436c 100644 --- a/index.js +++ b/index.js @@ -216,7 +216,6 @@ var BeautylogNodeCode; ; if (typeof options != "undefined") { codeSnippet.highlighted = consoleHighlight(codeSnippet.source, options.language); - console.log(codeSnippet.highlighted); } }; return codeFunction; diff --git a/package.json b/package.json index a7b6067..72b4034 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "cli-table2": "^0.1.9", "colors": "1.1.2", "highlight.js": "^9.1.0", - "html2console": "0.0.4", + "hlight": "0.0.1", "smartenv": "0.0.15" }, "devDependencies": { diff --git a/ts/beautylog.node.code.ts b/ts/beautylog.node.code.ts index 1389324..277f83a 100644 --- a/ts/beautylog.node.code.ts +++ b/ts/beautylog.node.code.ts @@ -2,29 +2,9 @@ module BeautylogNodeCode { export var init = function() { - var consoleHighlight = function(code:string,language:string) { - var fs = require('fs'), - path = require('path'), - htmlout = require('html2console'), - hljs = require('highlight.js'); - - var css = fs.readFileSync(path.join(__dirname, 'code.css'), 'utf8'); - - var result; - if (typeof language === "undefined"){ - result = hljs.highlight(language, code) - } else { - result = hljs.highlightAuto(code); - }; - - var html = result.value; - var output = htmlout.withCSS(css); - //console.log(html); - return output('
' + html + '
'); - }; - var codeFunction = function(codeString,options?){ + var hlight = require("hlight"); var codeSnippet = { source:codeString, highlighted:"default" @@ -34,8 +14,8 @@ module BeautylogNodeCode { return; }; if (typeof options != "undefined"){ - codeSnippet.highlighted = consoleHighlight(codeSnippet.source,options.language); - console.log(codeSnippet.highlighted) + codeSnippet.highlighted = hlight(codeSnippet.source,options.language); + //console.log(codeSnippet.highlighted) } }; return codeFunction;