-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
optional escape #6
Comments
Yeah, I see what you're saying. This sort of delves into another problem. I need to refactor marked completely so it's able to be modified from the outside. I explained it a bit in this pull request. I should really work on it and see what I can do. It looks like people really need this for sanitization, syntax highlighting, and something like GFM. I'm not sure exposing |
Well. Currently I'm using visionmedia/jade for rendering. It's capable of escaping per se. Hence, in my patterm, I'd just use identity |
I'm thinking of just checking for an An implementation could look like: var marked_ = require('marked');
var marked = function(text) {
var tok = marked_.lexer(text)
, l = tok.length
, i = 0
, t;
for (; i < l; i++) {
t = tok[i];
if (t.type === 'code') {
t.text = highlight(t.text, t.lang);
// marked should not escape this
t.escaped = true;
}
}
text = marked_.parser(tok);
return text;
}; |
Hi!
If output from
marked
is fed further to syntax highlighter (say, [https://github.com/andris9/highlight]) the resulting output contains html entities codes instead of symbols.Wonder if you could make call to
escape()
optional, or, better, makeescape
configurable from outside function.update:
marked.escape
would fit perfectly, i believe.TIA,
--Vladimir
The text was updated successfully, but these errors were encountered: