O'Reilly logo

HTML5 Data and Services Cookbook by Mite Mitreski, Gorgi Kosev

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using filters in Jade

Jade filters are powerful features which enable the users to use different markups inside Jade templates. Their primary use is to make templates even more succinct by enabling the user to use the appropriate tool for a particular section of the template.

In this recipe, we're going to use Jade filters to embed markdown inside our template and explain how filters work.

Getting ready

The client-side version of Jade https://github.com/visionmedia/jade is found in the jade.js file and does not support markdown filters out of the box. To add support for markdown we need edit this file and find the line that starts defining the markdown filter:

 markdown: function(str){ var md; // support markdown / discount try { …. } str = str.replace(/\\n/g, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required