markdown.md

 1---
 2title: Markdown
 3description: "Configure Markdown language support in Zed, including language servers, formatting, and debugging."
 4---
 5
 6# Markdown
 7
 8Markdown support is available natively in Zed.
 9
10- Tree-sitter: [tree-sitter-markdown](https://github.com/tree-sitter-grammars/tree-sitter-markdown)
11- Language Server: N/A
12
13## Syntax Highlighting Code Blocks
14
15Zed supports language-specific syntax highlighting of markdown code blocks by leveraging [tree-sitter language grammars](../extensions/languages.md#grammar). All [Zed supported languages](../languages.md), including those provided by official or community extensions, are available for use in markdown code blocks. All you need to do is provide a language name after the opening <kbd>```</kbd> code fence like so:
16
17````python
18```python
19import functools as ft
20
21@ft.lru_cache(maxsize=500)
22def fib(n):
23    return n if n < 2 else fib(n - 1) + fib(n - 2)
24```
25````
26
27## Configuration
28
29### Format
30
31Zed supports using Prettier to automatically re-format Markdown documents. You can trigger this manually via the {#action editor::Format} action or via the {#kb editor::Format} keyboard shortcut. Alternately, you can enable format on save.
32
33Configure formatting in Settings ({#kb zed::OpenSettings}) under Languages > Markdown, or add to your settings file:
34
35```json [settings]
36  "languages": {
37    "Markdown": {
38      "format_on_save": "on"
39    }
40  },
41```
42
43### List Continuation
44
45Zed automatically continues lists when you press Enter at the end of a list item. Supported list types:
46
47- Unordered lists (`-`, `*`, or `+` markers)
48- Ordered lists (numbers are auto-incremented)
49- Task lists (`- [ ]` and `- [x]`)
50
51Pressing Enter on an empty list item removes the marker and exits the list.
52
53To disable this behavior, configure in Settings ({#kb zed::OpenSettings}) under Languages > Markdown, or add to your settings file:
54
55```json [settings]
56  "languages": {
57    "Markdown": {
58      "extend_list_on_newline": false
59    }
60  },
61```
62
63### List Indentation
64
65Zed indents list items when you press Tab while the cursor is on a line containing only a list marker. This allows you to quickly create nested lists.
66
67To disable this behavior, configure in Settings ({#kb zed::OpenSettings}) under Languages > Markdown, or add to your settings file:
68
69```json [settings]
70  "languages": {
71    "Markdown": {
72      "indent_list_on_tab": false
73    }
74  },
75```
76
77### Trailing Whitespace
78
79By default Zed will remove trailing whitespace on save. If you rely on invisible trailing whitespace being converted to `<br />` in Markdown files you can disable this behavior.
80
81Configure in Settings ({#kb zed::OpenSettings}) under Languages > Markdown, or add to your settings file:
82
83```json [settings]
84  "languages": {
85    "Markdown": {
86      "remove_trailing_whitespace_on_save": false
87    }
88  },
89```