1# Zed Docs
2
3Welcome to Zed's documentation.
4
5This is built on push to `main` and published automatically to [https://zed.dev/docs](https://zed.dev/docs).
6
7To preview the docs locally you will need to install [mdBook](https://rust-lang.github.io/mdBook/) (`cargo install mdbook`) and then run:
8
9```sh
10mdbook serve docs
11```
12
13Before committing, verify that the docs are formatted in the way prettier expects with:
14
15```
16cd docs && pnpm dlx prettier@3.5.0 . --write && cd ..
17```
18
19## Preprocessor
20
21We have a custom mdbook preprocessor for interfacing with our crates (`crates/docs_preprocessor`).
22
23If for some reason you need to bypass the docs preprocessor, you can comment out `[preprocessor.zed_docs_preprocessor]
24` from the `book.toml`.:
25
26## Images and videos
27
28To add images or videos to the docs, upload them to another location (e.g., zed.dev, GitHub's asset storage) and then link out to them from the docs.
29
30Putting binary assets such as images in the Git repository will bloat the repository size over time.
31
32## Internal notes:
33
34- We have a Cloudflare router called `docs-proxy` that intercepts requests to `zed.dev/docs` and forwards them to the "docs" Cloudflare Pages project.
35- CI uploads a new version to the Pages project from `.github/workflows/deploy_docs.yml` on every push to `main`.
36
37### Table of Contents
38
39The table of contents files (`theme/page-toc.js` and `theme/page-doc.css`) were initially generated by [`mdbook-pagetoc`](https://crates.io/crates/mdbook-pagetoc).
40
41Since all this preprocessor does is generate the static assets, we don't need to keep it around once they have been generated.
42
43## Referencing Keybindings and Actions
44
45When referencing keybindings or actions, use the following formats:
46
47### Keybindings:
48
49`{#kb scope::Action}` - e.g., `{#kb zed::OpenSettings}`.
50
51This will output a code element like: `<code>Cmd+,|Ctrl+,</code>`. We then use a client-side plugin to show the actual keybinding based on the user's platform.
52
53By using the action name, we can ensure that the keybinding is always up-to-date rather than hardcoding the keybinding.
54
55### Actions:
56
57`{#action scope::Action}` - e.g., `{#action zed::OpenSettings}`.
58
59This will render a human-readable version of the action name, e.g., "zed: open settings", and will allow us to implement things like additional context on hover, etc.
60
61### Creating New Templates
62
63New templates can be created by implementing the `Template` trait for your desired template in the `docs_preprocessor` crate.
64
65### References
66
67- Template Trait: crates/docs_preprocessor/src/templates.rs
68- Example template: crates/docs_preprocessor/src/templates/keybinding.rs
69- Client-side plugins: docs/theme/plugins.js