Home Explore Blog CI



zed

docs/src/languages/markdown.md
ff7da2c022eae65f156722c1fccabd222e3c13b0aac0cd050000000300000609
# Markdown

Markdown support is available natively in Zed.

- Tree-sitter: [tree-sitter-markdown](https://github.com/tree-sitter-grammars/tree-sitter-markdown)
- Language Server: N/A

## Syntax Highlighting Code Blocks

Zed 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:

````python
```python
import functools as ft

@ft.lru_cache(maxsize=500)
def fib(n):
    return n if n < 2 else fib(n - 1) + fib(n - 2)
```
````

## Configuration

### Format

Zed 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 automatically format by enabling [`format_on_save`](./configuring-zed.md#format-on-save) in your settings.json:

```json
  "languages": {
    "Markdown": {
      "format_on_save": "on"
    }
  },
```

### Trailing Whitespace

By 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 with:

```json
  "languages": {
    "Markdown": {
      "remove_trailing_whitespace_on_save": false
    }
  },
```

Chunks
93783e06 (1st chunk of `docs/src/languages/markdown.md`)
Title: Markdown Support in Zed
Summary
Zed natively supports Markdown with syntax highlighting for code blocks using tree-sitter grammars. It also offers formatting via Prettier, which can be triggered manually or automatically on save. Users can configure the `format_on_save` setting to enable automatic formatting. By default, Zed removes trailing whitespace on save, but this can be disabled if trailing whitespace is intentionally used for line breaks.