Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/umstek/parcel-plugin-md-fm
@parcel-bundler plugin for loading markdown with parsed front-matter
https://github.com/umstek/parcel-plugin-md-fm
frontmatter markdown parcel-bundler
Last synced: 2 months ago
JSON representation
@parcel-bundler plugin for loading markdown with parsed front-matter
- Host: GitHub
- URL: https://github.com/umstek/parcel-plugin-md-fm
- Owner: umstek
- License: mit
- Created: 2018-09-16T02:26:03.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-10-23T17:56:31.000Z (over 1 year ago)
- Last Synced: 2024-11-06T05:52:31.062Z (3 months ago)
- Topics: frontmatter, markdown, parcel-bundler
- Language: JavaScript
- Size: 1.83 MB
- Stars: 8
- Watchers: 4
- Forks: 1
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-parcel - Markdown with Frontmatter - Plugin for markdown with frontmatter support. (Plugins / Templates)
README
# parcel-plugin-md-fm
Parcel plugin for loading markdown with parsed frontmatter.
## Install
With npm:
```bash
npm install parcel-plugin-md-fm --save-dev
```With yarn:
```bash
yarn add --dev parcel-plugin-md-fm
```## Use
Importing:
```js
import { content, data } from "./file.md";
```If you get errors or red underlines in editors, add a `markdown.d.ts` file containing:
```ts
declare module "*.md" {
const content: string;
const data: object;
}
```## Test
Tests not implemented yet.
## About
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](https://github.com/jonschlinkert/gray-matter#returned-object) 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](https://github.com/probablyup/markdown-to-jsx) (if you're using react).