remark-asset-copy
Copy assets from markdown to folder
Last updated 3 years ago .
· Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install remark-asset-copy 
SYNC missed versions from official npm registry.

remark-asset-copy

Copy assets from markdown to a folder inside public.

I created this because there was no easy way to have this type of file structure with next.js without using require().

/
|- content
|   |-post-slug
|   |   |- index.md
|   |   |- image.jpg

How to use

Basic example :

import remark from 'remark';
import vfile from 'vfile';
import frontmatter from 'remark-frontmatter';
import assetCopy from 'remark-asset-copy';

const processedContent = await remark()
  .use(frontmatter)
  .use(html)
  .use(copy, {
    destination: "public/assets",
  })
  .process(vfile.readSync(fullPath));
const contentHtml = processedContent.toString();

Tests

Basic testing is implemented but a deeper tests must be written

Current Tags

  • 0.0.1                                ...           latest (3 years ago)

1 Versions

  • 0.0.1                                ...           3 years ago
Maintainers (1)
Dependencies (3)
Dev Dependencies (6)

Copyright © npmmirror.com | 浙ICP备15033595号-63 |