chjj/marked — pull request #5 by pvorb (2011-10-30 00:08:58+00:00)
Title: Added possibility to ignore plain HTML markup

I added the possibility to ignore HTML markup by applying a second argument to the function call.

var text = 'i am using __markdown__ without HTML support.';
console.log(marked(text, { ignoreHtml: true }));

This will print

i am using markdown <span>without HTML support</span>.

You can test the behavior via

node test --ignore-html

This change should not impair marked's performance. If you don't use the second argument, everything remains the same as before. Then there's only one additional condition for each call of the function.

This comes in handy when you want to use markdown for user input on your website as it prevents users from doing XSS.

I hope you find this usable. At least, I do. ;-)