Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
markdownitIns
✓ import markdownit from 'markdown-it';
import markdownitIns from 'markdown-it-ins';
const md = markdownit().use(markdownitIns);
✗ import { markdownitIns } from 'markdown-it-ins';
The `markdown-it-ins` plugin is typically imported as a default export in ESM contexts and passed directly to `markdown-it`'s `.use()` method. `markdown-it` itself also supports ESM imports for `markdownit` as of recent versions.
require('markdown-it-ins')
✓ const markdownit = require('markdown-it');
const markdownitIns = require('markdown-it-ins');
const md = markdownit().use(markdownitIns);
✗ const markdownitIns = require('markdown-it-ins').default;
For CommonJS environments, `require('markdown-it-ins')` directly returns the plugin function. Similarly, `markdown-it` is required directly. This is the pattern shown in the official README.
window.markdownitIns
✓ <!-- In HTML, after loading markdown-it-ins.js -->
<script>
const md = window.markdownit();
md.use(window.markdownitIns);
console.log(md.render('++inserted++'));
</script>
When loaded directly in a browser without a package system, the plugin attaches itself globally as `window.markdownitIns`. `markdown-it` itself also exposes `window.markdownit`.
Demonstrates how to import and register `markdown-it-ins` with `markdown-it` to process `++text++` markup into `<ins>` HTML tags.
import markdownit from 'markdown-it';
import markdownitIns from 'markdown-it-ins';
// Initialize markdown-it with the ins plugin
const md = markdownit().use(markdownitIns);
// Example usage with ++inserted++ syntax
const markdownText = `Hello, ++this text should be inserted++.\n\nThis is a paragraph with ++another inserted phrase++ and a regular sentence.`;
const htmlOutput = md.render(markdownText);
console.log('Markdown Input:\n', markdownText);
console.log('\nHTML Output:\n', htmlOutput);
// Expected output: <p>Hello, <ins>this text should be inserted</ins>.</p><p>This is a paragraph with <ins>another inserted phrase</ins> and a regular sentence.</p>
Debug
Known issues
breakingVersion 3.0.0 and above of `markdown-it-ins` require `markdown-it` version 10.0.0 or higher. Using older versions of `markdown-it` with `markdown-it-ins` v3+ will lead to runtime errors or incorrect parsing due to internal API changes in `markdown-it`.fixEnsure your `markdown-it` dependency is at `^10.0.0` or higher. For npm, update `package.json` to `"markdown-it": "^10.0.0"` and run `npm install`.
affects: >=3.0.0
gotchaWhile `markdown-it-ins` handles `++text++` markup, `markdown-it` itself can be vulnerable to various security issues like XSS, ReDoS, or infinite loops if not updated or if parsing untrusted input. These vulnerabilities are in the core parser, not the plugin, but can affect the overall application security.fixAlways keep `markdown-it` updated to its latest stable version (currently `^13.0.0`). Sanitize all user-submitted markdown content, especially if `html: true` is enabled in `markdown-it` options, to prevent XSS.
affects: All versions of `markdown-it-ins` (indirectly via `markdown-it`)
gotchaThe `++text++` markup for `<ins>` follows CommonMark emphasis rules. This means nested `++` or specific character sequences might behave unexpectedly if not properly escaped or understood in the context of markdown parsing. For example, `++foo++bar++baz++` might not produce the desired nested `<ins>` tags.fixConsult the CommonMark specification for emphasis rules. If complex nesting or specific character handling is required, pre-process the markdown or use a more robust parser for such edge cases. Escaping with `\` might be necessary for literal `++` characters.
affects: >=1.0.0
Errors
Common errors & fixes
`md.use is not a function` or `Cannot read property 'use' of undefined`
The `markdown-it` instance was not correctly initialized or the `markdown-it-ins` plugin was not properly imported. In CommonJS, `require('markdown-it')` is the function, not a default export.
fixEnsure `markdownit` is initialized as `const md = require('markdown-it')();` (CommonJS) or `import markdownit from 'markdown-it'; const md = markdownit();` (ESM). Then pass `require('markdown-it-ins')` or `markdownitIns` to `md.use()`. Error: Plugin 'markdown-it-ins' cannot be used with markdown-it version X.Y.Z (expected >=10.0.0)
Using `markdown-it-ins` version 3.0.0 or higher with an incompatible older version of `markdown-it` (e.g., `<10.0.0`).
fixUpgrade your `markdown-it` package to version 10.0.0 or newer. In `package.json`, set `"markdown-it": "^10.0.0"` (or higher) and run `npm install`.
++text++ is rendered as plain text, not HTML <ins> tags
The `markdown-it-ins` plugin was either not correctly `use()`d with the `markdown-it` instance, or there's a conflict with another plugin/rule that processes the `++` syntax before `markdown-it-ins` can.
fixVerify that `md.use(markdownitIns)` is called after `markdownit` initialization. Check the order of plugins if multiple are used, as some may interfere with others' parsing rules. Ensure no custom `markdown-it` rules are inadvertently disabling or overriding the plugin's functionality.
Audit
Dependencies
markdown-itrequiredThis is a plugin for markdown-it and requires it as a peer dependency for parsing markdown.