What is markdown-it-mark?
The markdown-it-mark package is a plugin for the markdown-it Markdown parser that allows you to add support for the <mark> HTML tag, which is used to highlight text.
What are markdown-it-mark's main functionalities?
Highlight Text
This feature allows you to highlight text in your Markdown content by wrapping the text with double equal signs (==). The plugin converts this syntax into the <mark> HTML tag.
const md = require('markdown-it')().use(require('markdown-it-mark'));
const result = md.render('==highlighted text==');
console.log(result); // Outputs: <p><mark>highlighted text</mark></p>
Other packages similar to markdown-it-mark
markdown-it-attrs
The markdown-it-attrs package allows you to add attributes to Markdown elements. While it doesn't specifically focus on highlighting text, it provides a more general solution for adding custom attributes, including classes and IDs, to any Markdown element.
markdown-it-container
The markdown-it-container package allows you to create custom containers in your Markdown content. This can be used to create custom blocks with specific styles, including highlighted text, but requires more setup compared to markdown-it-mark.
markdown-it-highlightjs
The markdown-it-highlightjs package integrates syntax highlighting for code blocks using highlight.js. While it focuses on code syntax highlighting rather than general text highlighting, it serves a similar purpose in enhancing the readability of Markdown content.
markdown-it-mark
<mark>
tag plugin for markdown-it markdown parser.
v3.+ requires markdown-it
v10.+, see changelog.
==marked==
=> <mark>inserted</mark>
Markup uses the same conditions as CommonMark emphasis.
Install
node.js, browser:
npm install markdown-it-mark --save
bower install markdown-it-mark --save
Use
var md = require('markdown-it')()
.use(require('markdown-it-mark'));
md.render('==marked==')
Differences in browser. If you load script directly into the page, without
package system, module will add itself globally as window.markdownitMark
.
License
MIT