Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function renderText(options: renderText.IRenderOptions): Promise {
// Unpack the options.
let { host, source } = options;
// Escape the terminal codes and HTML tags.
let data = escape_for_html(source);
// Create the HTML content.
let content = ansi_to_html(data, { use_classes: true });
// Set the inner HTML for the host node.
host.innerHTML = `<pre>${content}</pre>`;
// Return the rendered promise.
return Promise.resolve(undefined);
}
.pipe(es.through(function(text){
var html = ansi_up.ansi_to_html(ansi_up.escape_for_html(''+text));
this.emit('data', html);
}, function(end){
this.emit('data', module.exports.footer);
constructor(options: RenderMime.IRenderOptions) {
super();
let source = Private.getSource(options);
let data = escape_for_html(source);
let pre = document.createElement('pre');
pre.innerHTML = ansi_to_html(data, {use_classes: true});
this.node.appendChild(pre);
this.addClass(TEXT_CLASS);
if (options.mimeType === 'application/vnd.jupyter.stderr') {
this.addClass(ERROR_CLASS);
}
}
}
render() {
const {pos, out} = this.props.line;
let html = ansi_up.escape_for_html(out || '');
html = ansi_up.ansi_to_html(html, opts);
html = ansi_up.linkify(html);
return (
<div></div>
);
}
}
while (br.nextSibling) {
node.removeChild(br.nextSibling);
}
} else {
while (node.lastChild) {
node.removeChild(node.lastChild);
}
}
var p = msg.lastIndexOf('\u001b[2K');
if (p !== -1) {
line = '';
msg = msg.substring(p + 4);
}
line += msg;
msg = sm.line(consumer, line, offset);
msg = ansi.escape_for_html(msg);
msg = msg.replace(/\u001b\[0G/g, '');
msg = msg.replace(/ /g, ' ');
div.innerHTML = ansi.ansi_to_html(msg, {
use_classes : true
});
Array.prototype.slice.call(div.childNodes).forEach(node.appendChild, node);
}