@emdaer/plugin-import

An emdaer plugin that imports content from another file

Stats

StarsIssuesVersionUpdatedCreatedSize
@emdaer/plugin-import
14293.2.31a year ago4 years agoMinified + gzip package size for @emdaer/plugin-import in KB

Readme

@emdaer/plugin-import Β· Travis Documented with emdaer Maintained with lerna

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

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.