# Quickstart

URL: /patitas/docs/get-started/quickstart/
Section: get-started
Description: Parse your first Markdown document in 2 minutes

---

> For a complete page index, fetch /patitas/llms.txt.

Parse Markdown to a typed AST and render to HTML in 2 minutes.

## Prerequisites

:::{checklist} Before You Start
:show-progress:
- [ ] [[docs/get-started/installation|Patitas installed]]
- [ ] Python 3.14+ available
:::{/checklist}

## Step 1: Parse Markdown

```python
from patitas import parse

source = """
# Welcome

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

- Item one
- Item two
"""

doc = parse(source)
```

## Step 2: Explore the AST

```python
# doc is a Document with children (tuple of Block nodes)
print(len(doc.children))  # 3 (Heading, Paragraph, List)

# Access the heading
heading = doc.children[0]
print(heading.level)  # 1
print(heading.children)  # (Text("Welcome"),)

# Access the paragraph
para = doc.children[1]
print(para.children)  # (Text, Strong, Text, Emphasis, Text)
```

## Step 3: Render to HTML

```python
from patitas import render

html = render(doc, source=source)
print(html)
```

Output:

```html
<h1>Welcome</h1>
<p>This is <strong>bold</strong> and <em>italic</em> text.</p>
<ul>
<li>Item one</li>
<li>Item two</li>
</ul>
```

> ⚠️ **`render()` does not sanitize output.** It is CommonMark-compliant and
> passes raw HTML and `javascript:`/`data:` URLs through verbatim. For untrusted
> content, sanitize the AST first (or render to plain text with `render_llm()`).

## Step 4: Sanitize Untrusted Input

When rendering Markdown you did not write, strip HTML and disallowed URL schemes
before rendering to HTML:

```python
from patitas import parse, render, sanitize
from patitas.sanitize import web_safe

doc = parse(untrusted_markdown)
html = render(sanitize(doc, policy=web_safe))
```

See [[docs/extending/llm-safety|LLM Safety]] for sanitization policies
(`web_safe`, `llm_safe`, `strict`) and the `render_llm()` pipeline.

## Step 5: All-in-One

For simple use cases, use the `Markdown` class:

```python
from patitas import Markdown

md = Markdown()
html = md("# Hello **World**")
print(html)
# <h1>Hello <strong>World</strong></h1>
```

## Next Steps

- [[docs/syntax/|Syntax Guide]] — Learn all Markdown syntax
- [[docs/reference/api|API Reference]] — Full API documentation
- [[docs/about/architecture|Architecture]] — How the parser works
