🛠️ToolsShed

Markdown zu HTML

Konvertiere Markdown-Quelltext in HTML-Code zum Einfügen in Projekte.

Häufig gestellte Fragen

Code-Implementierung

# pip install markdown
import markdown

# Basic conversion
text = """
# Hello World

This is **bold**, _italic_, and `inline code`.

- Item 1
- Item 2
- Item 3

[Visit example](https://example.com)
"""

html = markdown.markdown(text)
print(html)
# <h1>Hello World</h1>
# <p>This is <strong>bold</strong>, <em>italic</em>, and <code>inline code</code>.</p>
# ...

# With extensions (tables, fenced code, task lists)
html_ext = markdown.markdown(text, extensions=[
    'tables',
    'fenced_code',
    'toc',
    'nl2br',
])

# Convert a Markdown file
with open('README.md', 'r', encoding='utf-8') as f:
    content = f.read()

html_output = markdown.markdown(content, extensions=['tables', 'fenced_code'])
print(html_output)

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.