diff --git a/README.md b/README.md index 6206e32..6f31844 100644 --- a/README.md +++ b/README.md @@ -664,7 +664,13 @@ qmd get [: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)