@locoworks/remark-folder-import
TypeScript icon, indicating that this package has built-in type declarations

0.1.0Β β€’Β PublicΒ β€’Β Published

remark-code-import

πŸ“ Populate code blocks from files in a folder.

npm version

Starting from v1.0.0, the plugin is now ESM only. Node 12+ is needed to use it and it must be imported instead of required.

Installation

npm install -D remark-folder-import

Setup

The plugin can be imported via named export, there's no default export.

import codeImport from 'remark-folder-import';

See Using plugins for more instructions in the official documentation.

It can also be used in various of libraries: remark: MDX, Gatsby gatsby-plugin-mdx, Storybook docs.

Usage

Transform:

```js path=./Hello name=Hello

```

into:

```js path=./Hello name=Hello
console.log('Hello remark-code-import!');
```

The file path is relative to the markdown file path. You can use <rootDir> at the start of the path to import files relatively from the rootDir:

```js path=<rootDir>/<path-to-file> name=<comman-file-name-to-import>

```

License

Shrey Dhyani MIT

Package Sidebar

Install

npm i @locoworks/remark-folder-import

Weekly Downloads

18

Version

0.1.0

License

MIT

Unpacked Size

8.27 kB

Total Files

7

Last publish

Collaborators

  • shrey_dhyani
  • rjvim