# Markdown Preview

Markdown files normally open as rendered pages in *Lx*.

## What the preview shows

The preview supports:

- Headings and horizontal lines
- Bold, italic, strikeout, and inline code
- Lists, task-like text, and blockquotes
- Fenced and indented code blocks
- Tables
- Local images
- Links and heading links
- Inline and display math

Unsupported Markdown remains visible where possible.

## Move through the page

| Key | Action |
| --- | --- |
| Up or Down | Scroll by one rendered row |
| Page Up or Page Down | Scroll by one page |
| Shift+Space or Space | Scroll up or down by one page |
| Home or Ctrl+Home | Go to the top |
| End or Ctrl+End | Go to the bottom |
| Backspace | Return after following a heading link |

You can also use the mouse wheel. Drag with the left or middle mouse button to pan.

## Zoom

| Key | Action |
| --- | --- |
| `+` | Zoom in |
| `-` | Zoom out |
| `0` | Return to normal size |
| Ctrl+Mouse Wheel | Zoom at the pointer |

The current zoom appears in the status bar.

## Open links

Click a link to open it:

- Web links open in your usual web browser.
- Links to local files open in *Lx*.
- Heading links move within the preview.

After following a heading link, press **Backspace** to return to the previous position.

Hover over a link to see its destination. Images with titles also show their title after a short delay.

## Images

Standalone local images appear inside the preview. Relative paths start beside the Markdown file.

Remote images are not downloaded automatically. *Lx* shows a placeholder with the image address instead.

When a local image changes on disk, the preview refreshes its cached copy.

## Choose preview, view, or edit

Use the command line for a one-time choice:

```cli
lx --preview readme.md
lx --view readme.md
lx --edit readme.md
```

To change the usual choice for Markdown:

```lua
config.format_modes.md = "preview"
```

Use `"edit"` to open Markdown source for editing, or `"view"` for a read-only source view.

See [Opening Files](opening_files.md) for the complete opening order.

## Changes made by another program

A clean Markdown preview reloads when its file changes on disk. *Lx* keeps the same visible source area as closely as possible.

See [Files Changed Outside *Lx*](external_changes.md) for the full behavior.
