{"library":"md-node-inject","title":"Markdown AST Injection Utility","description":"md-node-inject is a utility for programmatically injecting Markdown Abstract Syntax Tree (AST) nodes into specific sections of another Markdown AST. Currently at stable version 2.0.0, this package is designed to work with parsed Markdown content, allowing for precise content integration without string manipulation. It differentiates itself by operating directly on ASTs, which prevents common issues associated with regex-based text replacement and ensures syntactically correct output. The library is ESM-only and requires Node.js v14 or higher for execution. It's often used in conjunction with other AST parsing and serialization libraries like `markdown-to-ast` and `ast-to-markdown` to form a complete Markdown processing pipeline.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install md-node-inject"],"cli":null},"imports":["import inject from 'md-node-inject';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import ast from 'markdown-to-ast';\nimport toMarkdown from 'ast-to-markdown';\nimport inject from 'md-node-inject';\n\nconst mdContent = `\n  # Sample\n  Description\n\n  # API\n\n  # License\n  MIT\n`;\n\nconst mdApiContent = `\n  ## method()\n  Method description\n`;\n\nconst mdContentAst = ast.parse(mdContent);\nconst mdApiContentAst = ast.parse(mdApiContent);\n\nconst injectionSection = 'API';\nconst mergedContentAst = inject(injectionSection, mdContentAst, mdApiContentAst);\n\nconst mergedContent = toMarkdown(mergedContentAst);\n\nconsole.log(mergedContent);","lang":"javascript","description":"This quickstart demonstrates parsing two Markdown strings into ASTs, injecting one AST (representing API documentation) into a specific section ('API') of the other, and then converting the resulting merged AST back into a Markdown string.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}