Comments (9)
Thanks for reporting this.
I'll have to do some thinking about how to handle ansiFilter.
from atom-script.
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.
from atom-script.
Underscore has a great one to handle that. _.escape
from atom-script.
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?
from atom-script.
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];
});
}
from atom-script.
There's a huge number of packages that rely on the Atom version of underscore, but I can understand the hesitation. @rgbkrk?
from atom-script.
Ah, it slipped my mind that it might be included in Atom. If it is there is no reason not to use it.
from atom-script.
I thought for sure underscore-plus was included as part of Atom, but even vim-mode includes it as a dependency.
from atom-script.
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>")
from atom-script.
Related Issues (20)
- HTMLDocument.registerElement is deprecated. HOT 1
- HTMLDocument.registerElement is deprecated.
- HTMLDocument.registerElement is deprecated. HOT 1
- HTMLDocument.registerElement is deprecated. HOT 1
- Runtime Input
- HTMLDocument.registerElement is deprecated. HOT 1
- TypeError HOT 1
- HTMLDocument.registerElement is deprecated. HOT 1
- HTMLDocument.registerElement is deprecated. HOT 1
- HTMLDocument.registerElement is deprecated. HOT 1
- certificate has expired HOT 1
- Port this to Pulsar
- HTMLDocument.registerElement is deprecated.
- HTMLDocument.registerElement is deprecated. HOT 1
- HTMLDocument.registerElement is deprecated. HOT 1
- HTMLDocument.registerElement is deprecated.
- HTMLDocument.registerElement is deprecated. HOT 1
- HTMLDocument.registerElement is deprecated. HOT 1
- HTMLDocument.registerElement is deprecated.
- HTMLDocument.registerElement is deprecated.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from atom-script.