Parse and serialize Markdown files with optional frontmatter
Go to file
2025-04-02 10:33:29 -04:00
src Initial commit 2025-04-02 10:33:29 -04:00
.gitignore Initial commit 2025-04-02 10:33:29 -04:00
biome.json Initial commit 2025-04-02 10:33:29 -04:00
build.ts Initial commit 2025-04-02 10:33:29 -04:00
bun.lock Initial commit 2025-04-02 10:33:29 -04:00
LICENSE Initial commit 2025-04-02 10:33:29 -04:00
package.json Initial commit 2025-04-02 10:33:29 -04:00
README.md Initial commit 2025-04-02 10:33:29 -04:00
tsconfig.json Initial commit 2025-04-02 10:33:29 -04:00

EMDY

Parse and serialize Markdown files with optional frontmatter

Install

Configure your environment to be aware of @endeavorance packages:

# Bunfig.toml
[install.scopes]
endeavorance = "https://git.astral.camp/api/packages/endeavorance/npm/"

Then install the package:

bun add @endeavorance/emdy

Usage

EMDY exports a top level EMDY constant which has two functions:

  • EMDY.parse(md: string, markdownKey = "content")
  • EMDY.stringify(data: Object, markdownKey = "content")
import EMDY from "@endeavorance/emdy";

const myMDFile = `
---
tags: ["fancy", "stuff"]
---

This is my markdown document!
`.trim();

const parsed = EMDY.parse(myMDFile);

console.log(parsed);
/*
{
  content: "This is my markdown document!",
  tags: ["fancy", "stuff"]
}
*/

const stringified = EMDY.stringify(parsed);
console.log(stringified);
// Prints the original document