Document clickable TTY link output in README

This commit is contained in:
dan mackinlay 2026-04-05 10:52:38 +00:00 committed by Tobias Lütke
parent 636631225e
commit 08b410696f

View File

@ -664,7 +664,13 @@ qmd get <file>[:line] # Get document, optionally starting at line
### Output Format
Default output is colorized CLI format (respects `NO_COLOR` env):
Default output is colorized CLI format (respects `NO_COLOR` env).
When stdout is a TTY, result paths are emitted as clickable terminal hyperlinks (OSC 8). Clicking a path opens the file in your editor using an editor URI template.
When stdout is not a TTY (for example piped to another command or redirected to a file), QMD emits plain text paths with no escape sequences.
TTY example:
```
docs/guide.md:42 #a1b2c3
@ -686,6 +692,27 @@ Discussion about code quality and craftsmanship
in the development process.
```
Configure the editor link target with `QMD_EDITOR_URI` (or `editor_uri` in config):
```sh
# VS Code (default)
export QMD_EDITOR_URI="vscode://file/{path}:{line}:{col}"
# Cursor
export QMD_EDITOR_URI="cursor://file/{path}:{line}:{col}"
# Zed
export QMD_EDITOR_URI="zed://file/{path}:{line}:{col}"
# Sublime Text
export QMD_EDITOR_URI="subl://open?url=file://{path}&line={line}"
```
Template placeholders:
- `{path}` absolute filesystem path (URI-encoded)
- `{line}` 1-based line number
- `{col}` or `{column}` 1-based column number
- **Path**: Collection-relative path (e.g., `docs/guide.md`)
- **Docid**: Short hash identifier (e.g., `#a1b2c3`) - use with `qmd get #a1b2c3`
- **Title**: Extracted from document (first heading or filename)