Fix rendering of :doc: links with explicit titles in help text in the terminal

This commit is contained in:
Kovid Goyal 2023-04-26 16:46:20 +05:30
parent bb33c66570
commit 7b6d11fd1e
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 7 additions and 6 deletions

View File

@ -91,7 +91,7 @@ for the operating system. Various special values are supported:
:code:`default` :code:`default`
run the default open program. Note that when using the hyperlink :code:`--type` run the default open program. Note that when using the hyperlink :code:`--type`
the default is to use the kitty :doc:`/open_actions` facilities. the default is to use the kitty :doc:`hyperlink handling </open_actions>` facilities.
:code:`launch` :code:`launch`
run :doc:`/launch` to open the program in a new kitty tab, window, overlay, etc. run :doc:`/launch` to open the program in a new kitty tab, window, overlay, etc.

View File

@ -140,11 +140,12 @@ func (self *Context) Prettify(text string) string {
return self.ref_hyperlink(val, "envvar-") return self.ref_hyperlink(val, "envvar-")
case "doc": case "doc":
text, target := text_and_target(val) text, target := text_and_target(val)
if text == target { no_title := text == target
target = strings.Trim(target, "/") target = strings.Trim(target, "/")
if title, ok := kitty.DocTitleMap[target]; ok { if title, ok := kitty.DocTitleMap[target]; ok && no_title {
val = title + " <" + target + ">" val = title + " <" + target + ">"
} } else {
val = text + " <" + target + ">"
} }
return self.ref_hyperlink(val, "doc-") return self.ref_hyperlink(val, "doc-")
case "iss": case "iss":