🏠 > Getting Started

☀️ 🌙

Getting Started

This guide will help you install mk2html and create your first HTML and PDF documents.

Installation

Basic Installation (HTML only)

pip install mk2html

With PDF Support

pip install mk2html[pdf]

After installing with PDF support, Chromium will be automatically downloaded on first use of mk2pdf.

Development Installation

pip install mk2html[dev]    # With testing tools
pip install mk2html[all]    # Everything

uv is a fast Python package installer:

# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install mk2html as a global tool
uv tool install mk2html

# Install with PDF support
uv tool install mk2html --with playwright

Quick Start

Convert Markdown to HTML

# Basic conversion
mk2html README.md

# Specify output file
mk2html README.md -o documentation.html

# With custom title
mk2html README.md -o docs.html --title "My Documentation"

Convert Markdown to PDF

# Basic conversion
mk2pdf README.md

# Specify output and page size
mk2pdf README.md -o documentation.pdf --page-size letter

# Landscape orientation
mk2pdf README.md -o wide.pdf --landscape

Your First Document

1. Create a Markdown file

Create a file called example.md:

# Welcome to My Document

This is a sample document with various features.

## Code Example

```python
def hello():
    print("Hello, World!")

Diagram

graph LR A[Start] --> B[Process] B --> C[End]

Table

Feature Status
TOC
Dark Mode
Mermaid
### 2. Convert to HTML

```bash
mk2html example.md -o example.html

3. Open in Browser

Open example.html in your browser to see:
- Auto-generated table of contents
- Syntax-highlighted code
- Rendered Mermaid diagram
- Dark/Light mode toggle

4. Convert to PDF (optional)

mk2pdf example.md -o example.pdf

Verify Installation

# Check versions
mk2html --version
mk2pdf --version

# View help
mk2html --help
mk2pdf --help

Next Steps