Skip to content

Instantly share code, notes, and snippets.

@pauljz
Created October 19, 2014 02:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pauljz/7fd5ee312d3e0b352772 to your computer and use it in GitHub Desktop.
Save pauljz/7fd5ee312d3e0b352772 to your computer and use it in GitHub Desktop.
pre.prettyprint
code.lang-html
:code
<html>
<head></head>
<body></body>
</html>
var jade = require('jade'),
fs = require('fs');
jade.filters.code = function( block ) {
return block
.replace( /&/g, '&amp;' )
.replace( /</g, '&lt;' )
.replace( />/g, '&gt;' )
.replace( /"/g, '&quot;' )
.replace( /#/g, '&#35;' )
.replace( /\\/g, '\\\\' )
.replace( /\n/g, '\\n' );
}
console.log(jade.renderFile('test.jade'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment