Skip to content

VisualMeaning/markdown-it-marked

Repository files navigation

markdown-it-marked

On NPM CI status UMD size

Plugin for markdown-it for marking substrings within text.

Supports insertion of <mark/> elements to show render-time configured matches such as search text results or other context not in the markdown input string.

For having <mark/> with markdown syntax see markdown-it-mark plugin instead.

Install

npm install --save markdown-it-marked

Use

import MarkdownIt from 'markdown-it';
import {envFromTerms, plugin as markedPlugin} from 'markdown-it-marked';

const md = MarkdownIt().use(markedPlugin);

const html = md.render('some text to _render_', envFromTerms(['text']));
// html === '<p>some <mark>text</mark> to <i>render</i></p>\n'

TODO

  • Add instructions for transpiling with application settings.
  • Fancy unicode handling for \b replacement.
  • Attribute setting from match via replacement override.

About

Plugin for markdown-it for marking substrings within text

Resources

License

Stars

Watchers

Forks

Packages

No packages published