क्विक स्टार्ट
unifast इंस्टॉल करें और एक मिनट से भी कम समय में अपना पहला Markdown document कंपाइल करें।
unifast इंस्टॉल करें और एक मिनट से भी कम समय में अपना पहला Markdown document कंपाइल करें।
इंस्टॉलेशन
मूल उपयोग
import { compile } from "@unifast/node";
const result = compile("# Hello, unifast!\n\nThis is **Markdown**.");
console.log(result.html);
// <h1>Hello, unifast!</h1>
// <p>This is <strong>Markdown</strong>.</p>बस इतना ही। एक import, एक function call, HTML output।
Plugins जोड़ना
Plugins कंपाइलर को अतिरिक्त features के साथ विस्तारित करते हैं। अधिकांश plugins @unifast/node में शामिल हैं और अंतर्निहित passes को configure करते हैं।
import { compile, frontmatter, gfm } from "@unifast/node";
const source = `---
title: My Post
date: 2025-01-15
---
# My Post
A table:
| Feature | Status |
|---------|--------|
| GFM | Yes |
- [x] Task complete
- [ ] Task pending
`;
const result = compile(source, {
plugins: [frontmatter(), gfm()],
});
console.log(result.frontmatter);
// { title: "My Post", date: "2025-01-15" }
console.log(result.html);
// GFM table और task list के साथ rendered HTMLSyntax Highlighting जोड़ना
import { compile, syntect } from "@unifast/node";
const result = compile(
'```js\nconsole.log("highlighted");\n```',
{ plugins: [syntect()] }
);
// syntax highlighting classes के साथ code blockआगे क्या
मुख्य अवधारणाएँ - compilation pipeline और architecture को समझें।
Syntax Highlighting - विस्तार से code block highlighting configure करें।
compile() - compile function के लिए पूर्ण API reference।