0.1.0 • Published 10 years ago
nunjucks-markdown-filter v0.1.0
nunjucks-markdown-filter
Nunjucks filter for converting a string to markdown using marked
Installation
npm install nunjucks-markdown-filterUsage
Process a string containing markdown:
{% set value = "This has **bold**" %}
{{ value | md }}
// -> This has <strong>bold</strong>By default, md will strip the wrapping <p> tags generated by marked. To prevent this, pass false as a parameter to the filter:
{% set value = "This has **bold**" %}
{{ value | md(false) }}
// -> <p>This has <strong>bold</strong></p>Generally, you'll then want to chain the built-in safe filter to ensure the HTML doesn't get escaped:
{{ value | md }}Tests
To run the jasmine unit tests:
npm run test
Contributing
Contributions are welcome. Please file issues with any problems that you experience. Pull requests are welcome.
0.1.0
10 years ago