@yandeu/parse-markdown
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

Parse Markdown

npm i @yandeu/parse-markdown

Three simple steps

1) Input

---
test: true
list:
  - one
  - two
---

# hello

This is a paragraph.

2) Code

import fs from 'fs/promises'
import { parseMarkdown } from '@yandeu/parse-markdown'

const main = async () => {
  const data = await fs.readFile('test.md', { encoding: 'utf-8' })
  const md = await parseMarkdown(data) // Promise<{ markdown: string; yaml: {}; }>
  console.log(md)
}
main()

3) Output

{
  "markdown": "<h1>hello</h1>\n<p>This is a paragraph.</p>",
  "yaml": { "test": true, "list": ["one", "two"] }
}

Need more? Make a pull request!

Readme

Keywords

none

Package Sidebar

Install

npm i @yandeu/parse-markdown

Weekly Downloads

4

Version

0.0.2

License

MIT

Unpacked Size

11.4 kB

Total Files

14

Last publish

Collaborators

  • yandeu