{"library":"markdown-it-for-inline","title":"markdown-it inline token iterator","description":"markdown-it-for-inline is a plugin for the markdown-it markdown parser, providing an iterator specifically designed for processing inline tokens. It allows developers to apply custom functions to specific types of inline tokens, such as 'text' or 'link_open', to modify their content or attributes. While the README notes that its speed \"will be not fastest of possible,\" it offers a quick and flexible method for prototyping and implementing custom rendering rules for inline content. The current stable version is 2.0.1, last published approximately two years ago as of late 2023. It maintains a stable API and integrates seamlessly with markdown-it's plugin architecture, focusing on enabling advanced manipulation of parsed inline structures rather than core parsing itself. Its release cadence is tied to stability and markdown-it compatibility, with updates typically addressing bug fixes or compatibility with newer markdown-it versions.","language":"javascript","status":"maintenance","last_verified":"Sun Apr 19","install":{"commands":["npm install markdown-it-for-inline"],"cli":null},"imports":["import iterator from 'markdown-it-for-inline';","const iterator = require('markdown-it-for-inline');","const iterator = window.markdownitForInline;"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import MarkdownIt from 'markdown-it';\nimport markdownitForInline from 'markdown-it-for-inline';\n\n// Initialize markdown-it with linkify enabled to ensure links are parsed\nconst md = new MarkdownIt({\n  linkify: true\n});\n\n// Use the plugin to modify 'link_open' tokens\n// This example makes all links open in a new window by adding target=\"_blank\"\nmd.use(markdownitForInline, 'url_new_win', 'link_open', function (tokens, idx) {\n  // `attrPush` adds a new attribute array or pushes to an existing one\n  tokens[idx].attrPush([ 'target', '_blank' ]);\n});\n\nconst markdownContent = `\nCheck out my [website](https://example.com) and another link: https://another.org.\nThis should also have target='_blank'.\n`;\n\nconst htmlResult = md.render(markdownContent);\n\nconsole.log(htmlResult);\n// Expected output would have <a href=\"...\" target=\"_blank\">...</a> for links.","lang":"javascript","description":"Demonstrates how to use markdown-it-for-inline to add 'target=\"_blank\"' to all generated links, making them open in a new browser tab or window.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}