markdown-it-alerts
v0.1.0
Published
Markdown-it plugin to create Bootstrap alerts
Downloads
261
Maintainers
Readme
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>