New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

twig-markdown

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

twig-markdown

Markdown extension for twig.js

latest
Source
npmnpm
Version
1.1.0
Version published
Weekly downloads
35
-50%
Maintainers
1
Weekly downloads
 
Created
Source

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>
        {% apply markdown_to_html %}
            # Title
        {% endapply %}
    </div>
    <div>
        {% set content = '# Title' %}
        {{ content|markdown_to_html }}
    </div>
</div>

Install

npm install twig-markdown --save

Use

In TypeScript:

import * as twig from 'twig';
import twigMarkdown from 'twig-markdown';
twig.extend(twigMarkdown);
const template = twig.twig({ data: "{% markdown %}# Foo{% endmarkdown %}" });
template.render();

In JavaScript:

const twigMarkdown = require('twig-markdown');
const twig = require('twig');
twig.extend(twigMarkdown);
const template = twig.twig({ data: "{% markdown %}# Foo{% endmarkdown %}" });
template.render();

In javascript with gulp-twig plugin:

const twigMarkdown = require('twig-markdown');
const twigFoo = require('twig-foo');
const 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 dependencies and you're good to go, assuming you also have globally typescript:

npm install

Test with mocha:

npm test

Run build in watch mode:

npm start

Keywords

markdown

FAQs

Package last updated on 18 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts