nunjucks-markdown-filter

Nunjucks filter for converting a string to markdown

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
nunjucks-markdown-filter
0.1.08 years ago8 years agoMinified + gzip package size for nunjucks-markdown-filter in KB

Readme

nunjucks-markdown-filter
Nunjucks filter for converting a string to markdown using marked

Installation

npm install nunjucks-markdown-filter

Usage

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.