{"_id":"mdast-util-inject","_rev":"4132981","name":"mdast-util-inject","description":"Inject some markdown into some other markdown, keeping heading structure intact.","dist-tags":{"latest":"1.1.0"},"maintainers":[{"name":"anandthakker","email":"vestibule@anandthakker.net"}],"time":{"modified":"2026-03-01T18:41:10.000Z","created":"2015-12-13T15:35:52.347Z","1.1.0":"2015-12-14T03:06:45.709Z","1.0.0":"2015-12-13T15:35:52.347Z"},"users":{},"author":{"name":"Anand Thakker","email":"vestibule@anandthakker.net","url":"http://anandthakker.net/"},"repository":{"type":"git","url":"git+https://github.com/anandthakker/mdast-util-inject.git"},"versions":{"1.1.0":{"main":"index.js","scripts":{"retire":"retire -p","lint":"eslint *.js test","docs-page":"documentation --lint --github --format html --output .","docs-readme":"documentation-readme -s Usage","docs-check":"documentation-readme -s Usage -c","test":"npm run retire && npm run lint && npm run docs-check && tap --cov test/*.js","prepublish":"npm run docs-readme"},"devDependencies":{"documentation":"^2.1.0-alpha2","documentation-readme":"^2.0.0","eslint":"^1.6.0","eslint-config-mourner":"^1.0.1","eslint-config-standard":"^4.4.0","eslint-plugin-standard":"^1.3.1","mdast":"^2.3.0","retire":"*","tap":"^2.1.1"},"name":"mdast-util-inject","description":"Inject some markdown into some other markdown, keeping heading structure intact.","version":"1.1.0","directories":{"test":"test"},"repository":{"type":"git","url":"git+https://github.com/anandthakker/mdast-util-inject.git"},"keywords":["mdast"],"author":{"name":"Anand Thakker","email":"vestibule@anandthakker.net","url":"http://anandthakker.net/"},"license":"MIT","bugs":{"url":"https://github.com/anandthakker/mdast-util-inject/issues"},"homepage":"https://github.com/anandthakker/mdast-util-inject#readme","dependencies":{"mdast-util-to-string":"^1.0.0"},"gitHead":"a383338ab080bd19b9c8f302d71b9f3e53b7be68","_id":"mdast-util-inject@1.1.0","_shasum":"db06b8b585be959a2dcd2f87f472ba9b756f3675","_from":".","_npmVersion":"3.3.4","_nodeVersion":"2.5.0","_npmUser":{"name":"anandthakker","email":"vestibule@anandthakker.net"},"dist":{"shasum":"db06b8b585be959a2dcd2f87f472ba9b756f3675","size":3446,"noattachment":false,"key":"/mdast-util-inject/-/mdast-util-inject-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/mdast-util-inject/download/mdast-util-inject-1.1.0.tgz"},"maintainers":[{"name":"anandthakker","email":"vestibule@anandthakker.net"}],"publish_time":1450062405709,"_hasShrinkwrap":false,"_cnpm_publish_time":1450062405709,"_cnpmcore_publish_time":"2021-12-16T14:44:56.216Z"},"1.0.0":{"main":"index.js","scripts":{"retire":"retire -p","lint":"eslint *.js test","docs-page":"documentation --lint --github --format html --output .","docs-readme":"documentation-readme -s Usage","docs-check":"documentation-readme -s API -c","test":"npm run retire && npm run lint && npm run docs-check && tap --cov test/*.js","prepublish":"npm run docs-readme"},"devDependencies":{"documentation":"^2.1.0-alpha2","documentation-readme":"^2.0.0","eslint":"^1.6.0","eslint-config-mourner":"^1.0.1","eslint-config-standard":"^4.4.0","eslint-plugin-standard":"^1.3.1","mdast":"^2.3.0","retire":"*","tap":"^2.1.1"},"name":"mdast-util-inject","description":"Inject some markdown into some other markdown, keeping heading structure intact.","version":"1.0.0","directories":{"test":"test"},"repository":{"type":"git","url":"git+https://github.com/anandthakker/mdast-util-inject.git"},"keywords":["mdast"],"author":{"name":"Anand Thakker","email":"vestibule@anandthakker.net","url":"http://anandthakker.net/"},"license":"MIT","bugs":{"url":"https://github.com/anandthakker/mdast-util-inject/issues"},"homepage":"https://github.com/anandthakker/mdast-util-inject#readme","dependencies":{"mdast-util-to-string":"^1.0.0"},"gitHead":"0739e924e987e638a00dfd64b2b9e046ea3d31a1","_id":"mdast-util-inject@1.0.0","_shasum":"1e49e2769c8f655f6231aa04d82fccdb7fe782d8","_from":".","_npmVersion":"2.14.2","_nodeVersion":"4.0.0","_npmUser":{"name":"anandthakker","email":"vestibule@anandthakker.net"},"dist":{"shasum":"1e49e2769c8f655f6231aa04d82fccdb7fe782d8","size":3336,"noattachment":false,"key":"/mdast-util-inject/-/mdast-util-inject-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/mdast-util-inject/download/mdast-util-inject-1.0.0.tgz"},"maintainers":[{"name":"anandthakker","email":"vestibule@anandthakker.net"}],"publish_time":1450020952347,"_hasShrinkwrap":false,"_cnpm_publish_time":1450020952347,"_cnpmcore_publish_time":"2021-12-16T14:44:56.502Z"}},"readme":"[![Circle CI](https://circleci.com/gh/anandthakker/mdast-util-inject.svg?style=svg)](https://circleci.com/gh/anandthakker/mdast-util-inject)\n[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)\n\nAn [mdast](https://github.com/wooorm/mdast) utility to inject some markdown\ninto some other markdown, keeping heading structure intact.\n\n## Install\n\n    npm install mdast-util-inject\n\n## Usage\n\n### inject\n\nInject some markdown into some other markdown at a desired heading.  Heading\nlevels in the source markdown are adjusted to match the target document\nbased on the target heading's level.  targetAst is modified in place\n\n**Parameters**\n\n-   `targetHeadingText` **string** The heading to look for in the target ast\n-   `targetAst` **object** The target markdown document, as an mdast\n-   `toInjectAst` **object** The source markdown to be injected into the target, also as an mdast.\n\n**Examples**\n\n```javascript\nvar mdast = require('mdast')\nvar inject = require('mdast-util-inject')\n\nvar target = mdast.parse('# A document\\n## Section1\\nBlah\\n## Section2\\nBlargh')\nvar newStuff = mdast.parse('# Some other document\\nwith some content')\ninject('Section1', target, newStuff)\n\nconsole.log(mdast.stringify(target))\n// outputs:\n// # A document\n//\n// ## Section1\n//\n// ### Some other document\n//\n// with some content\n//\n// ## Section2\n//\n// Blargh\n```\n\nReturns **boolean** whether the specified section was found and content inserted\n","_attachments":{},"homepage":"https://github.com/anandthakker/mdast-util-inject#readme","bugs":{"url":"https://github.com/anandthakker/mdast-util-inject/issues"},"license":"MIT"}