flounder

A simple gemini site builder
git clone git://git.alexwennerberg.com/flounder
Log | Files | Refs | README | LICENSE

commit c5a51786c8e2a261e59b4e10c4dc32b702f38212
parent d50ddbc2504ef28a2f52071a918326a8179805c2
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Sat, 15 Oct 2022 19:08:42 -0700

add anchor links to h2 and h3

Diffstat:
Mgmi2html.go | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gmi2html.go b/gmi2html.go @@ -98,14 +98,14 @@ func textToHTML(reqUrl *url.URL, text gemini.Text) ConvertedGmiDoc { title = text } // TODO deal with repetition case gemini.LineHeading2: - text := string(l.(gemini.LineHeading2)) - fmt.Fprintf(&b, "<h2>%s</h2>\n", html.EscapeString(text)) + text := html.EscapeString(string(l.(gemini.LineHeading2))) + fmt.Fprintf(&b, "<h2 id='%s'>%s <a href='#%s'>🔗</a></h2>\n", text, text, text) if title == "" { title = text } case gemini.LineHeading3: - text := string(l.(gemini.LineHeading3)) - fmt.Fprintf(&b, "<h3>%s</h3>\n", html.EscapeString(text)) + text := html.EscapeString(string(l.(gemini.LineHeading3))) + fmt.Fprintf(&b, "<h3 id='%s'>%s <a href='#%s'>🔗</a></h3>\n", text, text, text) if title == "" { title = text }