{
  "url": "https://unifast.dev/de/docs/introduction/key-concepts/",
  "locale": "de",
  "title": "Kernkonzepte",
  "description": "Verstehen Sie die mehrstufige Kompilierungspipeline von unifast, die integrierten Passes sowie die Funktionsweise der MdAst- und HAst-Transformationen.",
  "section": "introduction",
  "body": "unifast kompiliert Markdown über eine mehrstufige Pipeline. Das Verständnis dieser Stufen hilft Ihnen, den Compiler zu konfigurieren und die richtigen Plugins auszuwählen.\n\n### Kompilierungspipeline\n\n```\nInput text\n  → Parse (Markdown or MDX)\n  → IR0: MdAst (Markdown structure)\n  → Normalize + Built-in MdAst passes\n  → Lower to IR1: HAst (HTML structure)\n  → HAst passes (sanitize, highlight, etc.)\n  → Emit (HTML string)\n```\n\nJede Stufe transformiert das Dokument über eine Zwischendarstellung (IR).\n\n### Zwischendarstellungen\n\n| IR | Name | Zweck |\n|----|------|---------|\n| **IR0** | MdAst | Markdown-Struktur – Überschriften, Absätze, Listen, Code-Blöcke |\n| **IR1** | HAst | HTML-Struktur – Elemente, Attribute, Textknoten |\n| **IR2** | JsAst | Nur MDX – ESM-Imports und JSX-Ausdrücke |\n\nDer Parser erzeugt **MdAst**, der anschließend für die HTML-Ausgabe zu **HAst** heruntergebrochen wird. MDX-Eingaben erzeugen zusätzlich **JsAst**-Knoten für die JavaScript-Ausgabe.\n\n### Passes\n\nPasses sind Transformationen, die in bestimmten Phasen auf den AST angewendet werden. unifast verfügt über integrierte Passes für gängige Aufgaben:\n\n**MdAst-Passes** (vor dem Herunterbrechen zu HTML):\n\n- **Normalize** – Konsistente Struktur für nachgelagerte Passes\n- **Slug** – Erzeugen von Überschriften-IDs aus dem Textinhalt\n- **TOC** – Extrahieren eines Inhaltsverzeichnisses aus den Überschriften\n- **Definition Resolution** – Auflösen von Link-/Bildreferenz-Definitionen\n\n**HAst-Passes** (nach dem Herunterbrechen zu HTML):\n\n- **Sanitize** – Entfernen nicht erlaubter HTML-Elemente und -Attribute\n- **Highlight** – Anwenden der Syntax-Hervorhebung auf Code-Blöcke\n- **Cleanup** – Entfernen unnötiger Knoten und Leerzeichen\n\nPasses werden nach Phase geordnet – Sie müssen sich keine Gedanken über die Ausführungsreihenfolge machen.\n\n### Plugins\n\nPlugins sind TypeScript-Pakete, die integrierte Passes konfigurieren. Sie führen während der Kompilierung kein beliebiges JavaScript aus – stattdessen setzen sie Optionen, die steuern, wie der Rust-Kern Ihr Dokument verarbeitet.\n\n```ts\nimport { compile, gfm, sanitize } from \"@unifast/node\";\n\nconst result = compile(source, {\n  plugins: [gfm(), sanitize()],\n});\n```\n\nJedes Plugin gibt ein Konfigurationsobjekt zurück, das vor dem Ausführen des Rust-Kerns in die Kompilierungsoptionen eingemischt wird. Dadurch bleibt der Hot Path vollständig in nativem Code.\n\n### Ausgabeformate\n\nDer Compiler unterstützt über die Option `outputKind` mehrere Ausgabeformate:\n\n| Format | Beschreibung |\n|--------|-------------|\n| `\"html\"` | HTML-String (Standard) |\n| `\"hast\"` | HAst-JSON – der HTML-AST für benutzerdefiniertes Rendering |\n| `\"mdast\"` | MdAst-JSON – der Markdown-AST für die Analyse |\n| `\"mdx-js\"` | JavaScript-Modul-String (nur MDX) |\n\n### Diagnostik\n\nDer Compiler meldet Probleme über das `diagnostics`-Array im Ergebnis. Jede Diagnose enthält einen Schweregrad, eine Nachricht und einen optionalen Quellbereich zur präzisen Fehlerlokalisierung.\n\n```ts\nconst result = compile(source);\n\nfor (const d of result.diagnostics) {\n  console.warn(`[${d.level}] ${d.message}`);\n}\n```",
  "alternates": [
    {
      "locale": "en",
      "url": "https://unifast.dev/docs/introduction/key-concepts/",
      "api": "https://unifast.dev//api/docs/introduction/key-concepts.json"
    },
    {
      "locale": "ja",
      "url": "https://unifast.dev/ja/docs/introduction/key-concepts/",
      "api": "https://unifast.dev//api/ja/docs/introduction/key-concepts.json"
    },
    {
      "locale": "zh-CN",
      "url": "https://unifast.dev/zh-CN/docs/introduction/key-concepts/",
      "api": "https://unifast.dev//api/zh-CN/docs/introduction/key-concepts.json"
    },
    {
      "locale": "zh-TW",
      "url": "https://unifast.dev/zh-TW/docs/introduction/key-concepts/",
      "api": "https://unifast.dev//api/zh-TW/docs/introduction/key-concepts.json"
    },
    {
      "locale": "ko",
      "url": "https://unifast.dev/ko/docs/introduction/key-concepts/",
      "api": "https://unifast.dev//api/ko/docs/introduction/key-concepts.json"
    },
    {
      "locale": "fr",
      "url": "https://unifast.dev/fr/docs/introduction/key-concepts/",
      "api": "https://unifast.dev//api/fr/docs/introduction/key-concepts.json"
    },
    {
      "locale": "it",
      "url": "https://unifast.dev/it/docs/introduction/key-concepts/",
      "api": "https://unifast.dev//api/it/docs/introduction/key-concepts.json"
    },
    {
      "locale": "es",
      "url": "https://unifast.dev/es/docs/introduction/key-concepts/",
      "api": "https://unifast.dev//api/es/docs/introduction/key-concepts.json"
    },
    {
      "locale": "pt-BR",
      "url": "https://unifast.dev/pt-BR/docs/introduction/key-concepts/",
      "api": "https://unifast.dev//api/pt-BR/docs/introduction/key-concepts.json"
    },
    {
      "locale": "de",
      "url": "https://unifast.dev/de/docs/introduction/key-concepts/",
      "api": "https://unifast.dev//api/de/docs/introduction/key-concepts.json"
    },
    {
      "locale": "ru",
      "url": "https://unifast.dev/ru/docs/introduction/key-concepts/",
      "api": "https://unifast.dev//api/ru/docs/introduction/key-concepts.json"
    },
    {
      "locale": "hi",
      "url": "https://unifast.dev/hi/docs/introduction/key-concepts/",
      "api": "https://unifast.dev//api/hi/docs/introduction/key-concepts.json"
    },
    {
      "locale": "id",
      "url": "https://unifast.dev/id/docs/introduction/key-concepts/",
      "api": "https://unifast.dev//api/id/docs/introduction/key-concepts.json"
    },
    {
      "locale": "tr",
      "url": "https://unifast.dev/tr/docs/introduction/key-concepts/",
      "api": "https://unifast.dev//api/tr/docs/introduction/key-concepts.json"
    },
    {
      "locale": "vi",
      "url": "https://unifast.dev/vi/docs/introduction/key-concepts/",
      "api": "https://unifast.dev//api/vi/docs/introduction/key-concepts.json"
    }
  ]
}
