doc-snippets
doc-snippets
is a simple tool that allows you to extract and inject snippets from code into markdown files.
Installation
Using NPM:
npm install --save-dev doc-snippets
Using Yarn:
yarn add -D doc-snippets
Usage
doc-snippets
comes with a CLI tool which should handle most scenarios.
The CLI combine
is the only currently supported command, and can be used as follows:
doc-snippets combine <snippetsDir> <docsDir> <outputDir>
doc-snippets combine ./snippets ./src/docs ./docs
If you want to use doc-snippets
programatically, it offers two exported functions:
import { extractSnippets, injectSnippets } from "doc-snippets"
const snippets = await extractSnippets("./snippets")
await injectSnippets(snippets, "./dest")