Markdown AST injection utility




This package is ESM only
: Node 14+ is needed to use it and it must be imported instead of required.
``sh`
npm install md-node-inject
`js
import ast from 'markdown-to-ast';
import toMarkdown from 'ast-to-markdown';
import inject from 'md-node-inject';
const mdContent =
# Sample
Description
# API
# License
MIT;
const mdApiContent =
## method()
Method description;
const mdContentAst = ast.parse(mdContent);
const mdApiContentAst = ast.parse(mdApiContent);
const injectionSection = 'API';
const mergedContentAst = inject(injectionSection, mdContentAst, mdApiContentAst);
const mergedContent = toMarkdown(mergedContentAst);
console.log(mergedContent);
`
Output:
`mdSample
Description
Development Setup
1. Install Nix Package Manager
2. Install
direnv with your OS package manager3. Hook it
direnv into your shell4. At the top-level of your project run:
`sh
direnv allow
` > The next time your launch your terminal and enter the top-level of your
> project,
direnv` will check for changes.Under the MIT license. See LICENSE file for more details.