javascript - What is the better way to show a log in HTML showing the indentation? -


i have application gulp task, in task have retire, security package, when run task gulp, log this:

demo-mobile 1.1.5   ↳ debowerify 1.3.1     ↳ bower 1.3.12       ↳ semver 2.3.2 

i want save log in html format not possible, when run gulp, saves in html div.

child.stdout.setencoding('utf8');  child.stdout.on('data', function (data) {     console.log(data);  loginfo+= data; }); 

the html template doesn't have indentation console.

demo-mobile-1.1.5-↳-debowerify-1.3.1-↳-bower-1.3.12- 

somebody have , idea how fix behavior.

best regards.

well, there might better way, how about:

var input = "demo-mobile-1.1.5-↳-debowerify-1.3.1-↳-bower-1.3.12-";  var spaces = " ";  while (input.indexof("-↳-") >0) {  	input = input.replace("-↳-", "<br>"+spaces+"↳");	    spaces += " ";  }    // below show output.  var outputdiv = document.getelementbyid("output");  outputdiv.innerhtml = input;
<div id="output" style="white-space: pre">      </div>


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -