hagenburger / pimd

PIMD – Processing Instructions for Markdown
https://hagenburger.github.io/pimd-docs/
MIT License
20 stars 5 forks source link

New command: include #16

Open hagenburger opened 6 years ago

hagenburger commented 6 years ago

New feature as plugin

This command will include the result of another Markdown file into the current one.

The plugin should be named @pimd/include-plugin.

Specifications

<?include filename ?>

Renderes the given filename at the same location the include command was called from.

Example usage

main.md:

# Main Markdown file

Text 1

<?include second.md ?>

Text 2

second.md:

## Second Markdown file

Text 3

Rendered result (when main.md gets rendered):

<h1>Main Markdown file</h1>
<p>Text 1</p>
<h2>Second Markdown file</h2>
<p>Text 3</p>
<p>Text 2</p>

Unwanted

Make sure, the imported file does not get wrapped in for example a <p> like this:

<h1>Main Markdown file</h1>
<p>Text 1</p>
<p>
  <h2>Second Markdown file</h2>
  <p>Text 3</p>
</p>
<p>Text 2</p>

Help

For writing tests: This should either have files as test cases or mock the file methods from Node.

violetadev commented 6 years ago

#16 New command: include