Skip to content
Markdown-it plugin to create Bootstrap alerts
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
node_modules/markdown-it-container
LICENSE
README.md
index.js
package.json

README.md

markdown-it-alerts

Markdown-it plugin to create Bootstrap alerts.

E.g.:

::: warning
Hello world! [Link](#).
:::

Gets converted to:

<div class="alert alert-warning" role="alert">
<p>Hello world! <a href="#" class="alert-link">Link</a>.</p>
</div>

Install

$ npm install markdown-it-alerts --save

Usage

Enable plugin

var md = require('markdown-it');
var alerts = require('markdown-it-alerts');

md().use(alerts);

Options

Enable/disable adding class alert-link to links inside alerts.

var md = require('markdown-it');
var alerts = require('markdown-it-alerts');

md().use(alerts, {links: false});

Example

With option links enabled (by default):

This is a test. [Link](#).

::: success
Hello world! [Link](#).
:::

This is a test. [Link](#).

Gets converted to:

<p>This is a test. <a href="#">Link</a>.</p>
<div class="alert alert-success" role="alert">
<p>Hello world! <a href="#" class="alert-link">Link</a>.</p>
</div>
<p>This is a test. <a href="#">Link</a>.</p>
You can’t perform that action at this time.