Skip to content

jackfranklin/rollup-plugin-markdown

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
src
 
 
 
 
 
 
 
 

rollup-plugin-markdown

CircleCI

A Rollup plugin to parse Markdown files.

  • Showdown is used to parse the Markdown
  • Gray Matter is used to parse front-matter from the markdown file.

Install

npm install --save-dev @jackfranklin/rollup-plugin-markdown

yarn add --dev @jackfranklin/rollup-plugin-markdown

Example module output

import blogPost from './blog-post.md'

// from this import you get:
blogPost.html // the parsed HTML
blogPost.metadata // a JS object of the front-matter
blogPost.filename // blog-post.md - the filename that was imported

Rollup configuration

import markdown from '@jackfranklin/rollup-plugin-markdown'

export default {
  input: 'your-app.js',
  plugins: [markdown()],
}

You can pass in four options:

  • include and exclude, which are globs to limit which file(s) the plugin is applied to.
  • showdownOptions, which are options to pass to the Showdown converter.
  • showdownExtensions, which is an array of Showdown extensions.

The plugin will only parse .md files.

Changelog

0.3.0 [13th Jan 2021]

  • Allow Showdown options and extensions to be registered. Thanks to @mattfran and @arnorhs for their contributions.

0.2.0

  • expose full path to Markdown file as .path from the import.

0.1.0

  • Initial release

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •