Skip to content

yandeu/parse-markdown

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published