{"id":16111,"library":"markdown-it-ins","title":"Markdown-it Insert Text Plugin","description":"markdown-it-ins is a plugin for the popular markdown-it parser that extends its functionality to include support for the HTML `<ins>` (inserted text) tag. It allows users to mark text for insertion using the `++text++` syntax, mirroring the behavior of CommonMark's emphasis rules. The current stable version is 4.0.0, published approximately two years ago, which implies a release cadence tied to upstream `markdown-it` updates or specific feature additions. A key differentiator is its focused purpose: providing `<ins>` tag support specifically for the markdown-it ecosystem, offering a straightforward way to add this semantic markup. While markdown-it itself is highly configurable and extensible, this plugin provides a ready-to-use solution for this specific text-level semantic element without requiring custom rule implementations.","status":"active","version":"4.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/markdown-it/markdown-it-ins","tags":["javascript","markdown-it-plugin","markdown-it","markdown","insert","ins"],"install":[{"cmd":"npm install markdown-it-ins","lang":"bash","label":"npm"},{"cmd":"yarn add markdown-it-ins","lang":"bash","label":"yarn"},{"cmd":"pnpm add markdown-it-ins","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"This is a plugin for markdown-it and requires it as a peer dependency for parsing markdown.","package":"markdown-it","optional":false}],"imports":[{"note":"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.","wrong":"import { markdownitIns } from 'markdown-it-ins';","symbol":"markdownitIns","correct":"import markdownit from 'markdown-it';\nimport markdownitIns from 'markdown-it-ins';\n\nconst md = markdownit().use(markdownitIns);"},{"note":"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.","wrong":"const markdownitIns = require('markdown-it-ins').default;","symbol":"require('markdown-it-ins')","correct":"const markdownit = require('markdown-it');\nconst markdownitIns = require('markdown-it-ins');\n\nconst md = markdownit().use(markdownitIns);"},{"note":"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`.","symbol":"window.markdownitIns","correct":"<!-- In HTML, after loading markdown-it-ins.js -->\n<script>\n  const md = window.markdownit();\n  md.use(window.markdownitIns);\n  console.log(md.render('++inserted++'));\n</script>"}],"quickstart":{"code":"import markdownit from 'markdown-it';\nimport markdownitIns from 'markdown-it-ins';\n\n// Initialize markdown-it with the ins plugin\nconst md = markdownit().use(markdownitIns);\n\n// Example usage with ++inserted++ syntax\nconst markdownText = `Hello, ++this text should be inserted++.\\n\\nThis is a paragraph with ++another inserted phrase++ and a regular sentence.`;\n\nconst htmlOutput = md.render(markdownText);\n\nconsole.log('Markdown Input:\\n', markdownText);\nconsole.log('\\nHTML Output:\\n', htmlOutput);\n\n// 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>","lang":"javascript","description":"Demonstrates how to import and register `markdown-it-ins` with `markdown-it` to process `++text++` markup into `<ins>` HTML tags."},"warnings":[{"fix":"Ensure 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`.","message":"Version 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`.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Always 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.","message":"While `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.","severity":"gotcha","affected_versions":"All versions of `markdown-it-ins` (indirectly via `markdown-it`)"},{"fix":"Consult 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.","message":"The `++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.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"Ensure `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()`.","cause":"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.","error":"`md.use is not a function` or `Cannot read property 'use' of undefined`"},{"fix":"Upgrade 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`.","cause":"Using `markdown-it-ins` version 3.0.0 or higher with an incompatible older version of `markdown-it` (e.g., `<10.0.0`).","error":"Error: Plugin 'markdown-it-ins' cannot be used with markdown-it version X.Y.Z (expected >=10.0.0)"},{"fix":"Verify 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.","cause":"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.","error":"++text++ is rendered as plain text, not HTML <ins> tags"}],"ecosystem":"npm"}