@gerhobbelt/markdown-it-abbr

<abbr> tag for markdown-it markdown parser.

Usage no npm install needed!

<script type="module">
  import gerhobbeltMarkdownItAbbr from 'https://cdn.skypack.dev/@gerhobbelt/markdown-it-abbr';
</script>

README

markdown-it-abbr

Build Status NPM version Coverage Status

Abbreviation (<abbr>) tag plugin for markdown-it markdown parser.

v1.+ requires markdown-it v4.+, see changelog.

Markup is based on php markdown extra definition, but without multiline support.

Markdown:

*[HTML]: Hyper Text Markup Language
*[W3C]:  World Wide Web Consortium
The HTML specification
is maintained by the W3C.

HTML:

<p>The <abbr title="Hyper Text Markup Language">HTML</abbr> specification
is maintained by the <abbr title="World Wide Web Consortium">W3C</abbr>.</p>

Install

node.js, browser:

npm install @gerhobbelt/markdown-it-abbr --save

Use

var md = require('@gerhobbelt/markdown-it')()
            .use(require('@gerhobbelt/markdown-it-abbr'));

md.render(/*...*/); // See examples above

Pass a JSON list of abbr definitions

var abbrDefList = {
    "HTML": "Hyper Text Markup Language",
    "W3C": "World Wide Web Consortium"
};

var md = require('markdown-it')()
            .use(require('markdown-it-abbr'), abbrDefList);

md.render(/*...*/) // see example above

The list will be merged with the reference style abbreviation definitions like *[HTML]: Hyper Text Markup Language inside the markdown files (file definitions overwrite existing list definitions by default). To let list definitions overwrite existing definitions in the markdown file instead, pass a third argument listPriorsFile with true:

var md = require('markdown-it')()
            .use(require('markdown-it-abbr'), abbrDefList, true);

Differences in browser. If you load script directly into the page, without package system, module will add itself globally as window.markdownitAbbr.

License

MIT