Skip to content

Markdown

Parse frontmatter, convert to HTML, and generate table of contents.

3 modules

ModuleDescription
Frontmatter parsenYAML-Frontmatter aus Markdown-Inhalt extrahieren
Markdown zu HTMLMarkdown-Text in HTML umwandeln
Inhaltsverzeichnis erstellenEin Inhaltsverzeichnis aus Markdown-Überschriften erstellen

Modules

Frontmatter parsen

markdown.parse_frontmatter

YAML-Frontmatter aus Markdown-Inhalt extrahieren

Parameters:

NameTypeRequiredDefaultDescription
textstringYes-Markdown-Inhalt mit Frontmatter

Output:

FieldTypeDescription
frontmatterobjectGeparstes Frontmatter als Wörterbuch
contentstringMarkdown-Inhalt ohne Frontmatter

Example: Parse YAML frontmatter

yaml
text: ---
title: Hello World
date: 2024-01-01
tags:
  - python
  - markdown
---

# Hello World

Content here.

Markdown zu HTML

markdown.to_html

Markdown-Text in HTML umwandeln

Parameters:

NameTypeRequiredDefaultDescription
textstringYes-Markdown-Inhalt zum Konvertieren
extensionsarrayNo-Markdown-Erweiterungen aktivieren (nur mit der Markdown-Bibliothek verwendet)

Output:

FieldTypeDescription
htmlstringKonvertierter HTML-Inhalt
word_countnumberWortanzahl des Eingabetextes

Example: Convert markdown to HTML

yaml
text: # Hello

This is **bold** and *italic*.

Inhaltsverzeichnis erstellen

markdown.toc

Ein Inhaltsverzeichnis aus Markdown-Überschriften erstellen

Parameters:

NameTypeRequiredDefaultDescription
textstringYes-Markdown-Inhalt, um Überschriften zu extrahieren
max_depthnumberNo3Maximale Überschriftentiefe (1-6)

Output:

FieldTypeDescription
tocarrayListe der Überschriften mit Ebene, Titel und Slug
toc_markdownstringFormatiertes Markdown-Inhaltsverzeichnis

Example: Generate TOC from markdown

yaml
text: # Introduction

## Getting Started

### Installation

### Configuration

## Usage

## API Reference
max_depth: 3

Released under the Apache 2.0 License.