https://github.com/yuanqing/markdown-interpolate
:scissors: Interpolate the output of shell commands into Markdown
https://github.com/yuanqing/markdown-interpolate
docs markdown
Last synced: 3 months ago
JSON representation
:scissors: Interpolate the output of shell commands into Markdown
- Host: GitHub
- URL: https://github.com/yuanqing/markdown-interpolate
- Owner: yuanqing
- License: mit
- Created: 2020-10-07T12:47:15.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-01-30T07:40:55.000Z (over 4 years ago)
- Last Synced: 2025-03-29T11:55:39.387Z (3 months ago)
- Topics: docs, markdown
- Language: TypeScript
- Homepage:
- Size: 177 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# markdown-interpolate [](https://www.npmjs.com/package/markdown-interpolate) [](https://github.com/yuanqing/markdown-interpolate/actions?query=workflow%3Abuild)
> Interpolate the output of shell commands into Markdown
- Useful for inlining entire files (eg. `cat file.md`) or inserting dynamically-generated documentation (eg. `node script.js`) into Markdown
## Quick start
*Requires [Node.js](https://nodejs.org/).*
Given the following toy `README.md` file:
```md
# Example```
…with the following `file.md`:
```md
foo
```…and `script.js`:
```js
console.log('{ "bar": 42 }')
```Do:
```
$ npx markdown-interpolate README.md
```This will execute the shell commands marked by each **`markdown-interpolate:`** HTML comment, and interpolate the `stdout` between each corresponding pair of **`markdown-interpolate:`** and **`end`** HTML comments.
Our `README.md` will then be as follows:
````md
# Examplefoo
```json
{ "bar": 42 }
```````
See that:
- Specify a string (eg.
```json
) before **`markdown-interpolate:`** to insert it *before* the shell command’s `stdout`.
- Specify a string (eg.```
) before **`end`** to insert it *after* the shell command’s `stdout`.If `file.md` or `script.js` was changed, simply execute `npx markdown-interpolate README.md` again to automatically update `README.md`.
## Usage
```
Description
Interpolate the output of shell commands into MarkdownUsage
$ markdown-interpolate [options]Options
-v, --version Displays current version
-h, --help Displays this message```
## Installation
```
$ npm install --dev markdown-interpolate
```## License
[MIT](/LICENSE.md)