nunjucks-markdown-filter

0.1.0 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i nunjucks-markdown-filter

Weekly Downloads

5

Version

0.1.0

License

MIT

Last publish

Collaborators

  • brophdawg11