ZIm/docs/src
Ben Kunkle 3824751e61
Add meta description tag to docs pages (#35112)
Closes #ISSUE

Adds basic frontmatter support to `.md` files in docs. The only
supported keys currently are `description` which becomes a `<meta
name="description" contents="...">` tag, and `title` which becomes a
normal `title` tag, with the title contents prefixed with the subject of
the file.

An example of the syntax can be found in `git.md`, as well as below

```md
---
title: Some more detailed title for this page
description: A page-specific description
---

# Editor
```

The above will be transformed into (with non-relevant tags removed)

```html
<head>
    <title>Editor | Some more detailed title for this page</title>
    <meta name="description" contents="A page-specific description">
</head>
<body>
<h1>Editor</h1>
</body>
```

If no front-matter is provided, or If one or both keys aren't provided,
the title and description will be set based on the `default-title` and
`default-description` keys in `book.toml` respectively.

## Implementation details

Unfortunately, `mdbook` does not support post-processing like it does
pre-processing, and only supports defining one description to put in the
meta tag per book rather than per file. So in order to apply
post-processing (necessary to modify the html head tags) the global book
description is set to a marker value `#description#` and the html
renderer is replaced with a sub-command of `docs_preprocessor` that
wraps the builtin `html` renderer and applies post-processing to the
`html` files, replacing the marker value and the `<title>(.*)</title>`
with the contents of the front-matter if there is one.

## Known limitations

The front-matter parsing is extremely simple, which avoids needing to
take on an additional dependency, or implement full yaml parsing.

* Double quotes and multi-line values are not supported, i.e. Keys and
values must be entirely on the same line, with no double quotes around
the value.

The following will not work:

```md
---
title: Some
 Multi-line
 Title
---
```

* The front-matter must be at the top of the file, with only white-space
preceding it

* The contents of the title and description will not be html-escaped.
They should be simple ascii text with no unicode or emoji characters

Release Notes:

- N/A *or* Added/Fixed/Improved ...

---------

Co-authored-by: Katie Greer <katie@zed.dev>
2025-07-29 23:01:03 +00:00
..
ai docs: Add more improvements to the AI docs (#35160) 2025-07-27 14:06:18 -03:00
development docs: Consolidate backend setup docs into local-collaboration.md (#34653) 2025-07-19 12:01:33 -04:00
extensions Fix keybinds and 'No default binding' shown in docs (#35227) 2025-07-28 14:58:43 -04:00
languages Add runnable support for Deno.test (#34593) 2025-07-29 01:45:41 +02:00
accounts.md docs: Restructure and improve AI configuration docs (#35133) 2025-07-26 16:06:12 +00:00
additional-learning-materials.md update docs content (#11374) 2024-05-03 16:24:04 -06:00
channels.md docs: Adjust the channels page a bit (#31636) 2025-05-28 19:27:47 -03:00
collaboration.md Clarify guests vs collaborators in project sharing docs (#22945) 2025-01-10 15:42:52 +00:00
completions.md docs: Overhaul AI documentation (#29747) 2025-05-07 01:07:12 -03:00
configuring-languages.md Improve Java LSP documentation (#34410) 2025-07-14 18:16:43 -04:00
configuring-zed.md docs: Fix link in configuration documentation (#35249) 2025-07-28 22:59:46 +00:00
debugger.md docs: Discuss inlay_hints.show_value_hints in debugger docs (#34581) 2025-07-16 19:35:30 -04:00
development.md editor: Improve minimap performance (#33067) 2025-07-15 00:29:27 +03:00
diagnostics.md Add initial docs for editor diagnostics (#33325) 2025-06-24 22:21:27 +03:00
environment.md docs: Fix typo in environment documentation (#19164) 2024-10-13 16:47:09 -04:00
extensions.md extensions: Yet another PR for debugger touchups (#32822) 2025-06-17 07:34:55 +00:00
fonts.md Remove support for changing magnification of active pane (#31981) 2025-06-03 13:32:32 -04:00
getting-started.md Fix keybinds and 'No default binding' shown in docs (#35227) 2025-07-28 14:58:43 -04:00
git.md Add meta description tag to docs pages (#35112) 2025-07-29 23:01:03 +00:00
globs.md Glob documentation (#18789) 2024-10-15 17:21:04 -04:00
icon-themes.md icon_theme_selector: Add footer and related docs (#25042) 2025-02-20 00:02:24 +00:00
key-bindings.md Fix keybinds and 'No default binding' shown in docs (#35227) 2025-07-28 14:58:43 -04:00
languages.md docs: Add Yara language extension (#28693) 2025-04-14 12:40:13 -04:00
linux.md doc: Add docs for Forcing X11 scale factor (#35181) 2025-07-28 14:31:27 +05:30
multibuffers.md Fix a typo in the multi buffers documentation (#18535) 2024-09-30 15:28:46 +03:00
outline-panel.md docs: Add tweaks to the outline panel page (#18697) 2024-10-03 12:27:42 -03:00
remote-development.md docs: Update mentions to GitHub to use correct capitalization (#31996) 2025-06-03 14:55:24 -03:00
repl.md docs: Add tweaks to the REPL page (#18000) 2024-09-18 07:34:39 -03:00
snippets.md docs: Add better snippets documentation (#26853) 2025-03-19 18:05:05 +01:00
SUMMARY.md docs: Restructure and improve AI configuration docs (#35133) 2025-07-26 16:06:12 +00:00
system-requirements.md Add initial FreeBSD script & installation doc (#30981) 2025-06-06 23:14:25 +00:00
tasks.md task: Add ZED_RELATIVE_DIR task variable (#31657) 2025-05-29 11:50:36 +02:00
telemetry.md Telemetry docs cleanup (#35060) 2025-07-24 19:25:39 -06:00
themes.md chore: remove redundant word in comment (#30338) 2025-05-09 07:33:20 +00:00
vim.md vim: Add debug panel ex command (#33560) 2025-06-27 21:32:40 -06:00
visual-customization.md Docs: Fix invalid JSON syntax in Visual Customizations - Editor Scrollbar and Minimap (#35159) 2025-07-27 20:56:55 +03:00
windows.md Remove callout for hiring (#33674) 2025-06-30 23:35:00 -07:00
workspace-persistence.md Add visual customization section to documentation (#33133) 2025-06-21 22:55:53 -04:00