0.0.3 • Published 5 years ago

markdown-interpolate-files v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

markdown-interpolate-files npm Version build

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.md

This will:

  1. Interpolate the contents of foo.md into README.md.
  2. Execute bar.ts and interpolate its stdout into README.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 --base flag 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

License

MIT

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago