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
2 changed files with 7 additions and 6 deletions

View File

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