What is markdown-it-abbr?
The markdown-it-abbr package is a plugin for the markdown-it Markdown parser that allows you to define and use abbreviations in your Markdown documents. It provides a simple syntax for defining abbreviations and their expansions, which can then be used throughout your document.
What are markdown-it-abbr's main functionalities?
Define Abbreviations
This feature allows you to define abbreviations and their expansions using a simple syntax. In the example, 'HTML' is defined as 'Hyper Text Markup Language' and 'W3C' is defined as 'World Wide Web Consortium'.
const md = require('markdown-it')().use(require('markdown-it-abbr'));
const result = md.render('The HTML specification is maintained by the W3C.
*[HTML]: Hyper Text Markup Language
*[W3C]: World Wide Web Consortium');
console.log(result);
Use Abbreviations
Once abbreviations are defined, you can use them throughout your document. The plugin will automatically replace the abbreviations with their expansions when rendering the Markdown to HTML.
const md = require('markdown-it')().use(require('markdown-it-abbr'));
const result = md.render('The HTML specification is maintained by the W3C.');
console.log(result);
Other packages similar to markdown-it-abbr
markdown-it-footnote
The markdown-it-footnote package is another plugin for the markdown-it parser that allows you to add footnotes to your Markdown documents. While it serves a different purpose than markdown-it-abbr, both plugins enhance the functionality of markdown-it by adding support for additional Markdown syntax.
markdown-it-deflist
The markdown-it-deflist package adds support for definition lists to the markdown-it parser. Similar to markdown-it-abbr, it extends the capabilities of markdown-it by introducing new syntax for a specific type of content, in this case, definition lists.
markdown-it-container
The markdown-it-container package allows you to create custom containers in your Markdown documents. This plugin is similar to markdown-it-abbr in that it extends the markdown-it parser with additional functionality, but it focuses on creating custom block-level containers rather than handling abbreviations.
markdown-it-abbr
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 markdown-it-abbr --save
bower install markdown-it-abbr --save
Use
var md = require('markdown-it')()
.use(require('markdown-it-abbr'));
md.render()
Differences in browser. If you load script directly into the page, without
package system, module will add itself globally as window.markdownitAbbr
.
License
MIT