@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
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
Returns Array<string> list of possible paths for the given file