Markdown-It Mark Plugin

4.0.0 · maintenance · verified Tue Apr 21

The `markdown-it-mark` package is a plugin for the `markdown-it` markdown parser, designed to extend its functionality by adding support for the HTML `<mark>` tag. It enables users to highlight text within their Markdown documents using the `==text==` syntax, which is then rendered as `<mark>text</mark>`. The current stable version is 4.0.0, last published approximately two years ago, indicating a mature and stable project likely in maintenance mode rather than rapid feature development. This plugin is highly focused, providing a straightforward implementation for text highlighting that adheres to similar rules as CommonMark emphasis. Its key differentiator is its seamless integration with the `markdown-it` ecosystem, offering a lightweight solution for a common formatting need without introducing complex parsing behaviors.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize `markdown-it` and register `markdown-it-mark` to parse and render `==marked==` syntax into `<mark>` HTML tags.

import markdownit from 'markdown-it';
import markdownitMark from 'markdown-it-mark';

// Initialize markdown-it with the mark plugin
const md = markdownit();
md.use(markdownitMark);

// Markdown input with mark syntax
const markdownInput = 'This is ==marked== text and also ==important== content.';

// Render to HTML
const htmlOutput = md.render(markdownInput);

console.log(htmlOutput);
// Expected output: <p>This is <mark>marked</mark> text and also <mark>important</mark> content.</p>

view raw JSON →