npm

Join us for the "JavaScript Supply Chain Security" tech talk, presented by VP of Security, Adam Baldwin. 6/20 at 10am PT.Sign up here »

twig-markdown

0.2.1 • Public • Published

Twig.js Markdown

{% markdown %} tag support for Twig templates using twig.js and marked compiler. Compatible with gulp-twig.

<div class="content">
    <div>
        {% markdown %}
            # Embed markdown directly in your template…
        {% endmarkdown %}
    </div>
    <div>
        {% markdown '../or/embed/external/file.md' %}{% endmarkdown %}
    </div>
</div>

Install

npm install twig-markdown --save

Use

In typescript:

import twigMarkdown = require('twig-markdown');
import twig = require('twig');
 
twig.extend(twigMarkdown);

In javascript:

var twigMarkdown = require('twig-markdown');
var twig = require('twig');
 
twig.extend(twigMarkdown);

In javascript with gulp-twig plugin:

var twigMarkdown = require('twig-markdown');
var twigFoo = require('twig-foo');
var twig = require('gulp-twig');
 
// With only markdown extension.
twig({data: {}, extend: twigMarkdown});
 
// With multiple extensions.
twig({data: {}, extend: function(Twig){
    twigMarkdown(Twig);
    twigFoo(Twig);
}});

Contribute

Install npm and tsd dependencies and you're good to go, assuming you also have globally installed ts-node and typescript packages, make sure to cd dependency.

npm install

Build using gulp, make sure to cd build.

gulp # or gulp watch 

Test using mocha.

# TypeScript directly… 
mocha --require ts-node/register --ui tdd source/ts/Test/**/*.ts
# …or built js. 
mocha --ui tdd product/js/Test/**/*.js

install

npm i twig-markdown

Downloadsweekly downloads

70

version

0.2.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability