Skip to content

Instantly share code, notes, and snippets.

@atheken
Created August 27, 2013 00:51
Show Gist options
  • Save atheken/6348491 to your computer and use it in GitHub Desktop.
Save atheken/6348491 to your computer and use it in GitHub Desktop.
When you pre-compile your jade templates for the browser, interpolated locals will still require jade.escape, but it's a simple fix, and here it is!
// this is required in order to properly escape
// jade interpolation
jade = {
escape: function(html){
return String(html)
.replace(/&/g, '&')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;');
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment