5.0 KiB
5.0 KiB
File view: Markdown
Markdown files (.md) open in the file view 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 · Related: File view, Diff, Pass on to Agent
At a glance
+--------------------------------------------------------------------+
| (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 |
| +----------------------------------------------+ |
+--------------------------------------------------------------------+
- Bar: the badge
mdand the path, as for every file. - Preview button: switches between the source and the rendered document. It is lit while the Preview shows.
- Diff button: only on a changed file. See Diff.
- Rendered document: the Markdown as formatted text, in a readable column of about 68 characters.
- Link: click to follow it.
- 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.wordWrapchanges this. - On a changed file, the source view shows the teal line marks like any file view.
Switch to Preview
- Click Preview in the bar, or press
Cmd+M. Press again to go back to the source. Cmd+Mdoes 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 |
 |
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.
Zoom
- The Preview keeps its own text size.
Cmd++andCmd+-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: editing, saving and the bar.
- File view: Diff: compare a changed Markdown file with its last commit.
- Pass on to Agent: send a reference to the file to Claude.
- Configuration: where
editor.wordWraplives.