HTML output renders/causes errors.

I was testing outputting HTML to the terminal for debugging reasons and and something similar to the image above turned up, not really ideal and could cause errors for other output that includes HTML-like syntax or symbols.
Can be fixed by adding:
line = line.replace /</g, '<'.replace />/g, '>'
before ansiFilter in display, but there are probably better ways to do it.
Thanks for reporting this.
I'll have to do some thinking about how to handle ansiFilter.
I'd like it to be as simple as escaping brackets like you did above, but we're going to run into issues on other entities that should be escaped as well (&, etc.). Rather than escaping them ourselves, I'd like to rely on good libraries/jQuery/spacepen to do it for us.
Underscore has a great one to handle that. _.escape
The way underscore does it is pretty much the exact same thing I did just with added ",' and & added in. Wouldn't it be a little bloated to add a library for that when adding those characters to my hack would be an identical fix?
The way Mustache.js does it pretty clean and trivial to port to CoffeeScript. Since HTML is the only thing that would risk being rendered in the Atom browser environment it should be enough.
var entityMap = {
"&": "&",
"<": "<",
">": ">",
'"': '"',
"'": ''',
"/": '/'
};
function escapeHtml(string) {
return String(string).replace(/[&<>"'\/]/g, function (s) {
return entityMap[s];
});
}
There's a huge number of packages that rely on the Atom version of underscore, but I can understand the hesitation. @rgbkrk?
Ah, it slipped my mind that it might be included in Atom. If it is there is no reason not to use it.
I thought for sure underscore-plus was included as part of Atom, but even vim-mode includes it as a dependency.
I'm honestly fine with either having our own escape function or using underscore's. Either way, I've tested this out and am quite happy:
display: (css, line) ->
line = _.escape(line)
line = @ansiFilter.toHtml(line)
@output.append("<pre class='line #{css}'>#{line}</pre>")