smartlog-destination-local/ts/beautylog.node.code.ts
2016-02-02 14:49:08 +01:00

23 lines
745 B
TypeScript

/// <reference path="./index.ts" />
module BeautylogNodeCode {
export var init = function() {
var codeFunction = function(codeString,options?){
var hlight = require("hlight");
var codeSnippet = {
source:codeString,
highlighted:"default"
};
if (typeof codeString != "string"){
console.log("beautylog.code() expects a string as first argument!");
return;
};
if (typeof options != "undefined"){
codeSnippet.highlighted = hlight(codeSnippet.source,options.language);
//console.log(codeSnippet.highlighted)
}
};
return codeFunction;
}
}