{"id":24922936,"url":"https://github.com/demsking/md-node-inject","last_synced_at":"2026-04-29T23:04:09.897Z","repository":{"id":46098352,"uuid":"103732623","full_name":"demsking/md-node-inject","owner":"demsking","description":"Markdown AST injection utility","archived":false,"fork":false,"pushed_at":"2022-07-18T07:51:53.000Z","size":287,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-11T22:29:07.382Z","etag":null,"topics":["ast","inject","injection","markdown"],"latest_commit_sha":null,"homepage":"https://gitlab.com/demsking/md-node-inject","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/demsking.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-16T07:03:05.000Z","updated_at":"2023-11-24T10:44:13.000Z","dependencies_parsed_at":"2022-08-20T09:50:18.058Z","dependency_job_id":null,"html_url":"https://github.com/demsking/md-node-inject","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/demsking/md-node-inject","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/demsking%2Fmd-node-inject","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/demsking%2Fmd-node-inject/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/demsking%2Fmd-node-inject/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/demsking%2Fmd-node-inject/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/demsking","download_url":"https://codeload.github.com/demsking/md-node-inject/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/demsking%2Fmd-node-inject/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261004704,"owners_count":23095714,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ast","inject","injection","markdown"],"created_at":"2025-02-02T11:34:09.878Z","updated_at":"2026-04-29T23:04:04.863Z","avatar_url":"https://github.com/demsking.png","language":"JavaScript","funding_links":["https://www.buymeacoffee.com/demsking"],"categories":[],"sub_categories":[],"readme":"# Markdown AST injection utility\n\n[![npm](https://img.shields.io/npm/v/md-node-inject.svg)](https://www.npmjs.com/package/md-node-inject)\n[![Build status](https://gitlab.com/demsking/md-node-inject/badges/main/pipeline.svg)](https://gitlab.com/demsking/md-node-inject/pipelines)\n[![Test coverage](https://gitlab.com/demsking/md-node-inject/badges/main/coverage.svg)](https://gitlab.com/demsking/md-node-inject/pipelines)\n[![Buy me a beer](https://img.shields.io/badge/Buy%20me-a%20beer-1f425f.svg)](https://www.buymeacoffee.com/demsking)\n\n## Install\n\nThis package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c)\n: Node 14+ is needed to use it and it must be imported instead of required.\n\n```sh\nnpm install md-node-inject\n```\n\n## Usage\n\n```js\nimport 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);\n```\n\n**Output:**\n\n```md\n# Sample\nDescription\n\n# API\n## method()\nMethod description\n\n# License\nMIT\n```\n\n## Development Setup\n\n1. [Install Nix Package Manager](https://nixos.org/manual/nix/stable/installation/installing-binary.html)\n\n2. [Install `direnv` with your OS package manager](https://direnv.net/docs/installation.html#from-system-packages)\n\n3. [Hook it `direnv` into your shell](https://direnv.net/docs/hook.html)\n\n4. At the top-level of your project run:\n\n   ```sh\n   direnv allow\n   ```\n\n   \u003e The next time your launch your terminal and enter the top-level of your\n   \u003e project, `direnv` will check for changes.\n\n## License\n\nUnder the MIT license. See [LICENSE](https://gitlab.com/demsking/md-node-inject/blob/main/LICENSE) file for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdemsking%2Fmd-node-inject","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdemsking%2Fmd-node-inject","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdemsking%2Fmd-node-inject/lists"}