@emdaer/plugin-import Β·

An emdaer plugin that imports content from another file
Usage
@emdaer/plugin-import is an emdaer plugin β see the emdaer monorepo for more information
Documentation
Example
Import a plain markdown file like so:
This content was imported!
Import and call a function that returns/resolves a string like so: A function named printThrice is called with the string Hello world! x3:
Hello world! x3
Hello world! x3
Hello world! x3
Usage in README
<!--emdaer-p
- '@emdaer/plugin-import'
- path: .emdaer/importExample.md
runEmdaer: true
-->
<!--emdaer-p
- '@emdaer/plugin-import'
- path: .emdaer/printThrice
args:
- Hello world! x3
-->
importPlugin
Import content into your readme
Content can be imported in a few ways, as long as itβs a string
- a local path to a markdown file, a partial of your readme. ex: .emdaer/README/USAGE.md.
- a path to a node module that contains markdown files in its pacakge. ex: moduleName/lib/file.md.
- a path to a node module exporting a string. ex: moduleName/lib/todo.js
- a path to a node module exporting a function that takes arguments and returns/resolves to a string ex: module
Parameters
options any
options.path string? The filename to require.
options.args array? An array of args to pass to the exported function at the required path.
options.runEmdaer boolean? Whether or not to run emdaer on the content.
Examples
<!--emdaer-p
- '@emdaer/plugin-import'
- path: .emdaer/importExample.md
runEmdaer: true
-->
<!--emdaer-p
- '@emdaer/plugin-import'
- path: .emdaer/printThrice
args:
- Hello world! x3
-->
Returns Promise<string> The contents at the path or the execution results
getMarkdownPaths
Gets a list of possible paths for the given file
This may be a relative path, check that first, then check in node modules.
Parameters
filePath string
path string the node module or relative path to append to the possible directories.
Returns Array<string> list of possible paths for the given file