mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 22:28:24 +02:00
Add support for the 🔗 role to prettify
This commit is contained in:
@@ -112,6 +112,11 @@ type rst_format_match struct {
|
|||||||
role, payload string
|
role, payload string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *Context) link(x string) string {
|
||||||
|
text, url := text_and_target(x)
|
||||||
|
return self.hyperlink_for_url(url, text)
|
||||||
|
}
|
||||||
|
|
||||||
func (self *Context) ref_hyperlink(x string, prefix string) string {
|
func (self *Context) ref_hyperlink(x string, prefix string) string {
|
||||||
text, target := text_and_target(x)
|
text, target := text_and_target(x)
|
||||||
url := "kitty+doc://" + utils.CachedHostname() + "/#ref=" + prefix + target
|
url := "kitty+doc://" + utils.CachedHostname() + "/#ref=" + prefix + target
|
||||||
@@ -156,6 +161,8 @@ func (self *Context) Prettify(text string) string {
|
|||||||
return self.ref_hyperlink(val, "term-")
|
return self.ref_hyperlink(val, "term-")
|
||||||
case "code":
|
case "code":
|
||||||
return self.Code(remove_backslash_escapes(val))
|
return self.Code(remove_backslash_escapes(val))
|
||||||
|
case "link":
|
||||||
|
return self.link(val)
|
||||||
case "option":
|
case "option":
|
||||||
idx := strings.LastIndex(val, "--")
|
idx := strings.LastIndex(val, "--")
|
||||||
if idx < 0 {
|
if idx < 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user