0.0.3 • Published 5 years ago
markdown-interpolate-files v0.0.3
markdown-interpolate-files

Interpolate files or the output of scripts into Markdown
Usage
Given the following toy README.md file:
# Example
<!-- include: foo.md -->
<!-- end -->
<!-- execute: bar.ts -->
<!-- end -->…with foo.md:
foo…and bar.ts:
async function main () {
console.log('bar')
}
main()Do:
$ npx markdown-interpolate-files README.mdThis will:
- Interpolate the contents of
foo.mdintoREADME.md. - Execute
bar.tsand interpolate itsstdoutintoREADME.md.
README.md will then be updated as follows:
# Example
<!-- include: foo.md -->
foo
<!-- end -->
<!-- execute: bar.ts -->
bar
<!-- end -->Run the markdown-interpolate-files CLI again to update the content between each pair of opening/closing HTML comments.
Other usage notes:
- By default, files/scripts are always resolved relative to the Markdown file. Use the
--baseflag to set the base directory to resolve files/scripts. - Besides
.ts, other types of scripts (eg..js,.sh) can be referenced as well.
CLI
$ npx markdown-interpolate-files --help
Description
Interpolate files or the output of scripts into Markdown
Usage
$ markdown-interpolate-files <pattern> [options]
Options
-b, --base Base directory to resolve files or scripts
-v, --version Displays current version
-h, --help Displays this message
Examples
$ markdown-interpolate-files --root scripts