1.0.1 • Published 3 years ago

snowpack-markdown-it-plugin v1.0.1

Weekly downloads
4
License
ISC
Repository
-
Last release
3 years ago

@vcarrier/snowpack-plugin-markdown-it

A Snowpack plugin for converting .md files to HTML with your own custom render function. Great for building a DIY static site generator.

Getting started

Installation:

npm i -D @vcarrier/snowpack-plugin-markdown-it

Example usage:

// snowpack.config.js
module.exports = {
  mount: {
    // Make sure your .md files are in a mounted directory
  },
  plugins: [
    [
      '@vcarrier/snowpack-plugin-markdown-it',
      {
        // markdown-it config
        md: {
          html: true,
          typographer: true,
        },

        // `content` is the HTML generated from your .md file
        // `metadata` is your frontmatter object
        // The return value should be an HTML string
        render(content, metadata) {
          return renderPost({ content, ...metadata })
        },
      },
    ],
  ],
  /* ... */
}