Schnellstart
Installieren Sie unifast und kompilieren Sie Ihr erstes Markdown-Dokument in unter einer Minute.
Installieren Sie unifast und kompilieren Sie Ihr erstes Markdown-Dokument in unter einer Minute.
Installation
Grundlegende Verwendung
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>Das war’s. Ein Import, ein Funktionsaufruf, HTML-Ausgabe.
Plugins hinzufügen
Plugins erweitern den Compiler um zusätzliche Funktionen. Die meisten Plugins sind in @unifast/node enthalten und konfigurieren integrierte Passes.
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);
// Rendered HTML with GFM table and task listSyntax-Hervorhebung hinzufügen
import { compile, syntect } from "@unifast/node";
const result = compile(
'```js\nconsole.log("highlighted");\n```',
{ plugins: [syntect()] }
);
// Code block with syntax highlighting classesWie geht es weiter?
Kernkonzepte – Verstehen Sie die Kompilierungspipeline und die Architektur.
Syntax-Hervorhebung – Konfigurieren Sie die Hervorhebung von Code-Blöcken im Detail.
compile() – Vollständige API-Referenz für die compile-Funktion.