smartlog-destination-local/ts/beautylog.node.code.ts

23 lines
745 B
TypeScript
Raw Normal View History

2016-01-30 05:19:44 +00:00
/// <reference path="./index.ts" />
module BeautylogNodeCode {
export var init = function() {
var codeFunction = function(codeString,options?){
2016-02-02 13:49:08 +00:00
var hlight = require("hlight");
2016-01-30 05:19:44 +00:00
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"){
2016-02-02 13:49:08 +00:00
codeSnippet.highlighted = hlight(codeSnippet.source,options.language);
//console.log(codeSnippet.highlighted)
2016-01-30 05:19:44 +00:00
}
};
return codeFunction;
}
}