# File view: Markdown Markdown files (`.md`) open in the [file view](file-view.md) like any other file, with one extra: a rendered Preview. You switch between the source and the Preview with the **Preview** button in the bar or with `Cmd+M`. [Guide index](index.md) ยท Related: [File view](file-view.md), [Diff](file-view-diff.md), [Pass on to Agent](pass-on-to-agent.md) ## At a glance ```text +--------------------------------------------------------------------+ | (1)[md] docs/setup.md (2)[Preview] (3)[Diff] | +--------------------------------------------------------------------+ | (4) | | Setup | | ----------------------------------------------- | | Install the app with Herd. Read the [guide] first. (5) link | | | | -- First item | | -- Second item | | | | +----------------------------------------------+ | | | composer install | (6) code block | | +----------------------------------------------+ | +--------------------------------------------------------------------+ ``` 1. **Bar**: the badge `md` and the path, as for every file. 2. **Preview button**: switches between the source and the rendered document. It is lit while the Preview shows. 3. **Diff button**: only on a changed file. See [Diff](file-view-diff.md). 4. **Rendered document**: the Markdown as formatted text, in a readable column of about 68 characters. 5. **Link**: click to follow it. 6. **Code block**: fenced code in a dark panel, with syntax colours. ## Features ### The source view - A Markdown file opens in its source view: editable text with syntax colours. - Headings, list markers, quote markers, rules, code spans and link targets get their own colours. - A fenced code block (with three or more backticks or tildes) uses the colours of its language, for example ```` ```php ````. - Word wrap is on for Markdown by default, so long paragraphs fold onto the next row. `editor.wordWrap` changes this. - On a changed file, the source view shows the teal line marks like any [file view](file-view.md). ### Switch to Preview - Click **Preview** in the bar, or press `Cmd+M`. Press again to go back to the source. - `Cmd+M` does nothing on a file that is not Markdown. - The Preview shows the current text, unsaved edits included. - The Preview is read-only. You can select and copy its text. - Your undo history and unsaved edits stay intact while you are in the Preview. ### What the Preview renders | Markdown | Shown as | |---|---| | `#` to `######` headings | Bold headings; a level-3 heading gets a thin rule under it | | Paragraphs | Body text; lines of one paragraph join into one | | `**bold**`, `__bold__` | Bold | | `*italic*`, `_italic_` | Italic | | `~~text~~` | Strikethrough | | `` `code` `` | Inline code | | ```` ``` ```` fenced blocks | Code panel with syntax colours, scrolls sideways | | `>` quotes | Amber rule on the left, quote text; quotes may nest | | `-`, `*`, `+` lists | Items with an amber dash | | `1.` or `1)` lists | Numbered items | | GFM tables | A table with a header row; `:---:` and `---:` set centre and right alignment | | `---`, `***`, `___` | A thin horizontal rule | | `![alt](path)` | The image, from the project or from the web; the alt text while it loads or when it fails | | `[text](url)` | A link | Not rendered: nested lists, task-list checkboxes, raw HTML, and headings underlined with `===` or `---`. Fenced code in the Preview needs backticks; a `~~~` fence shows as plain text. ### Links in the Preview - A web link (`http`, `https`) opens in your browser. - A `mailto:` link opens your mail app. - A link to a file in the project opens that file in the file view. - A link to an anchor (`#section`) is shown as text but does nothing. - Links with other schemes, such as `javascript:`, are dropped for safety. ### Right-click in the Preview - Right-click anywhere in the Preview for **Pass on reference** and **Copy reference**. The reference points at line 1 of the file. See [Pass on to Agent](pass-on-to-agent.md). ### Zoom - The Preview keeps its own text size. `Cmd++` and `Cmd+-` zoom only the source view. ## Keyboard | Keys | Action | |---|---| | `Cmd+M` | Switch between source and Preview | | `Cmd+S` | Save (from the source view) | ## Settings | Setting | Default | Effect | |---|---|---| | `editor.wordWrap` | `markdown` | `markdown` wraps only Markdown files; `on` wraps every file; `off` wraps none | ## Related - [File view](file-view.md): editing, saving and the bar. - [File view: Diff](file-view-diff.md): compare a changed Markdown file with its last commit. - [Pass on to Agent](pass-on-to-agent.md): send a reference to the file to Claude. - [Configuration](configuration.md): where `editor.wordWrap` lives.