Back to results
jackfranklin/rollup-plugin-markdown(opens in a new tab)
Language: JavaScript
- stars
- 24
- watchers
- 2
- forks
- 8
- open issues
- 4
- Last updated
- 10/27/2026
Language: JavaScript
A Rollup plugin to parse Markdown files. The parsed Markdown can either be imported as a JavaScript module, or piped through the Rollup build process.
npm install --save-dev @jackfranklin/rollup-plugin-markdown
yarn add --dev @jackfranklin/rollup-plugin-markdown
import blogPost from './src/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 blogPost.path // ./src/blog-post.md - the path to the file that was imported
import markdown from '@jackfranklin/rollup-plugin-markdown' export default { input: 'your-app.js', plugins: [ markdown({ include?: 'src/md/*.md', exclude?: 'README.md', showdownOptions?: '', showdownExtensions?: '', allowImports?: true, parseFrontMatterAsMarkdown?: false }) ], }
You can pass in six 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.allowImports, a flag to tell the plugin whether or not to export the Markdown files as JavaScript modules.parseFrontMatterAsMarkdown, a flag that converts front-matter values into inline HTML (without enclosing <p>/<p> tags).The plugin will only parse .md files.
You can use the following declaration to satisfy the TypeScript compiler:
declare module '*.md' { const styles: { html: string filename: string path: string metadata: Record<string, string> } export default styles }
.path from the import.