markdown-it-trimmer

0.1.5 • Public • Published

A markdown-it plugin to trim some whitespace from the resulting markup. The trimming occurs during the rendering process of the markup.

Opening list items <li>

After opening list items with <li> , any whitespace, including new lines, is removed. This can be useful when you are styling your list items with li::before and use display settings of inline or inline-grid (as an example). In such scenarios a whitespace between the opening <li> tag and the following content would always be rendered as an additional space by the browser, which is something you typically wouldn´t want.

HTML written inside of your markdown text will not be affected by this plugin - only markdown output rendering is altered.

With the markdown-it-trimmer the following output html will never be produced:

<ul>
    <li>
        <p>Hello world</p>
    </li>
</ul>

Instead, the markup will get trimmed into:

<ul>
    <li><p>Hello world</p>
    </li>
</ul>

Usage

var markdownIt = require('markdown-it');
var markdownItTrimmer = require('markdown-it-trimmer');

markdownIt({
        html: true
    })
    .use(markdownItTrimmer);

Configuration

There is no configuration.

Dependents (0)

Package Sidebar

Install

npm i markdown-it-trimmer

Homepage

ulf.codes

Weekly Downloads

0

Version

0.1.5

License

MIT

Unpacked Size

3.62 kB

Total Files

4

Last publish

Collaborators

  • ulfschneider