diff --git a/markup/lexer.go b/markup/lexer.go
index 9ff58f5..6ba3b94 100644
--- a/markup/lexer.go
+++ b/markup/lexer.go
@@ -143,8 +143,8 @@ numberState:
launchpadState:
switch {
case startsWith("=>"):
- href, text, class := Rocketlink(line, state.name)
- state.buf += fmt.Sprintf(`
%s`, class, href, text)
+ href, text, class, icon := Rocketlink(line, state.name)
+ state.buf += fmt.Sprintf(` %s%s`, class, href, text, icon)
case startsWith("```"):
state.where = "pre"
addLine(state.buf + "")
diff --git a/markup/link.go b/markup/link.go
index ef91e68..8aac40c 100644
--- a/markup/link.go
+++ b/markup/link.go
@@ -10,7 +10,7 @@ import (
//
// => addr display
// [[addr|display]]
-func LinkParts(addr, display, hyphaName string) (href, text, class string) {
+func LinkParts(addr, display, hyphaName string) (href, text, class, icon string) {
if display == "" {
text = addr
} else {
@@ -26,9 +26,9 @@ func LinkParts(addr, display, hyphaName string) (href, text, class string) {
if strings.HasPrefix(text, "//") && len(text) > 2 {
text = text[2:]
}
- return addr, text + fmt.Sprintf(`
`, destination), "wikilink_external"
+ return addr, text, "wikilink_external", fmt.Sprintf(`
`, destination)
case strings.HasPrefix(addr, "/"):
- return addr, text, class
+ return addr, text, class, ""
case strings.HasPrefix(addr, "./"):
hyphaName = canonicalName(path.Join(hyphaName, addr[2:]))
case strings.HasPrefix(addr, "../"):
@@ -39,12 +39,12 @@ func LinkParts(addr, display, hyphaName string) (href, text, class string) {
if !HyphaExists(hyphaName) {
class += " wikilink_new"
}
- return "/page/" + hyphaName, text, class
+ return "/page/" + hyphaName, text, class, ""
}
// Parse markup line starting with "=>" according to wikilink rules.
// See http://localhost:1737/page/wikilink
-func Rocketlink(src, hyphaName string) (href, text, class string) {
+func Rocketlink(src, hyphaName string) (href, text, class, icon string) {
src = strings.TrimSpace(src[2:]) // Drop =>
if src == "" {
return
diff --git a/markup/paragraph.go b/markup/paragraph.go
index 8f90085..88d5e43 100644
--- a/markup/paragraph.go
+++ b/markup/paragraph.go
@@ -56,8 +56,8 @@ func getLinkNode(input *bytes.Buffer, hyphaName string) string {
currBuf.WriteByte(b)
}
}
- href, text, class := LinkParts(addrBuf.String(), displayBuf.String(), hyphaName)
- return fmt.Sprintf(`%s`, href, class, html.EscapeString(text))
+ href, text, class, icon := LinkParts(addrBuf.String(), displayBuf.String(), hyphaName)
+ return fmt.Sprintf(`%s%s`, href, class, html.EscapeString(text), icon)
}
// getTextNode splits the `input` into two parts `textNode` and `rest` by the first encountered rune that resembles a span tag. If there is none, `textNode = input`, `rest = ""`. It handles escaping with backslash.