/ piacw.com / dev / final / node_modules / markdown-it-container /

[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  -  
[DIR]dist/2 years ago -  
[TXT]CHANGELOG.md2 years ago151 0fb859dc fixed mobile overflwo options [كارل مبارك]
[   ]LICENSE2 years ago1.0K0fb859dc fixed mobile overflwo options [كارل مبارك]
[TXT]README.md2 years ago2.5K0fb859dc fixed mobile overflwo options [كارل مبارك]
[   ]bower.json2 years ago551 0fb859dc fixed mobile overflwo options [كارل مبارك]
[   ]index.js2 years ago4.1K0fb859dc fixed mobile overflwo options [كارل مبارك]
[   ]package.json2 years ago1.7K0fb859dc fixed mobile overflwo options [كارل مبارك]
README.md

markdown-it-container

Build Status NPM version Coverage Status

Plugin for creating block-level custom containers for markdown-it markdown parser.

v2.+ requires markdown-it v5.+, see changelog.

With this plugin you can create block containers like:

::: warning
*here be dragons*
:::

.... and specify how they should be rendered. If no renderer defined, <div> with container name class will be created:

<div class="warning">
<em>here be dragons</em>
</div>

Markup is the same as for fenced code blocks. Difference is, that marker use another character and content is rendered as markdown markup.

Installation

node.js, browser:

$ npm install markdown-it-container --save
$ bower install markdown-it-container --save

API

var md = require('markdown-it')()
            .use(require('markdown-it-container'), name [, options]);

Params:

Example

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

md.use(require('markdown-it-container'), 'spoiler', {

  validate: function(params) {
    return params.trim().match(/^spoiler\s+(.*)$/);
  },

  render: function (tokens, idx) {
    var m = tokens[idx].info.trim().match(/^spoiler\s+(.*)$/);

    if (tokens[idx].nesting === 1) {
      // opening tag
      return '<details><summary>' + m[1] + '</summary>\n';

    } else {
      // closing tag
      return '</details>\n';
    }
  }
});

console.log(md.render('::: spoiler click me\n*content*\n:::\n'));

// Output:
//
// <details><summary>click me</summary>
// <p><em>content</em></p>
// </details>

License

MIT

Apache/2.4.38 (Debian) Server at www.karls.computer Port 80