Parcel plugin for loading markdown with parsed frontmatter.
With npm:
npm install parcel-plugin-md-fm --save-dev
With yarn:
yarn add --dev parcel-plugin-md-fm
Importing:
import { content, data } from "./file.md";
If you get errors or red underlines in editors, add a markdown.d.ts
file containing:
declare module "*.md" {
const content: string;
const data: object;
}
Tests not implemented yet.
This uses the excellent gray-matter
library under the hood which separates and then translates yaml
or other frontmatter from a markdown file. See jonschlinkert/gray-matter for the exact result format.
Markdown is returned as a string (content
) without further parsing so that you can use it with a parser/formatter of your choice like markdown-to-jsx (if you're using react).