md-fusion
v0.1.0
Published
Convert notes between HTML/JSON and Markdown with YAML Frontmatter. Ideal for Notion/Obsidian migrations.
Maintainers
Readme
md-fusion
Convert notes between HTML/JSON and Markdown with YAML Frontmatter.
A lightweight Node.js library and CLI tool to bridge the gap between structured note data (JSON) and static file systems (Markdown). It seamlessly handles YAML Frontmatter, making it perfect for migrating content to Obsidian, Notion, or Jekyll/Hugo sites.
📦 Installation
# Global Install (CLI)
npm install -g md-fusion
# Project Install (Library)
npm install md-fusion💻 CLI Usage
Convert JSON Notes to Markdown Files Perfect for importing into Obsidian or Dendron.
md-fusion to-md notes.json -o ./my-vault
# Creates: ./my-vault/note_title.md, ./my-vault/another_note.mdParse Markdown to JSON Useful for processing existing Markdown files.
md-fusion from-md ./my-vault/daily-note.md
# Output: JSON object to console🔧 API Usage
import { toMarkdown, fromMarkdown } from 'md-fusion';
const myNote = {
title: "Project Idea",
content: "<h1>Big Plans</h1><p>Do the thing.</p>",
tags: ["ideas", "work"],
created: "2023-10-27T10:00:00Z"
};
// 1. Convert Object to Markdown string with Frontmatter
const md = toMarkdown(myNote);
console.log(md);
/* Output:
---
title: Project Idea
tags:
- ideas
- work
created: 2023-10-27T10:00:00Z
---
# Big Plans
Do the thing.
*/
// 2. Parse Markdown string back to Object
const noteObj = fromMarkdown(md);
console.log(noteObj.title); // "Project Idea"🧩 Input/Output Format
Expects (or produces) a standard JSON Note object:
interface Note {
title: string;
content: string; // HTML
tags: string[];
created: string; // ISO 8601
updated?: string;
[key: string]: any; // Any extra JSON keys become YAML Frontmatter
}License
MIT
{ github.com/mgks }
![]()
