Add section IDs to headers in html conversion v1 REJECTED

alex wennerberg: 1
 Add section IDs to headers in html conversion

 1 files changed, 3 insertions(+), 3 deletions(-)
I think there might be a problem with section IDs. Take this example:

	# Title
	=> #Title

In a Gemini client, the link would make a new request to the current URL
with the fragment #Title.
But with this patch, it would be converted to the following HTML:

	<h1 id="Title">Title</h1>
	<p><a href="#Title">#Title</a></p>

And then the link would wrongly point to the header.
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~adnano/kiln-devel/patches/14307/mbox | git am -3
Learn more about email & git

[PATCH] Add section IDs to headers in html conversion Export this patch

 html.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/html.go b/html.go
index 1620a84..538775c 100644
--- a/html.go
+++ b/html.go
@@ -50,13 +50,13 @@ func gmiToHTML(text gmi.Text) []byte {
			fmt.Fprintf(&b, "%s\n", html.EscapeString(text))
		case gmi.LineHeading1:
			text := string(l.(gmi.LineHeading1))
			fmt.Fprintf(&b, "<h1>%s</h1>\n", html.EscapeString(text))
			fmt.Fprintf(&b, "<h1 id='%[1]s'>%[1]s</h1>\n", html.EscapeString(text))
		case gmi.LineHeading2:
			text := string(l.(gmi.LineHeading2))
			fmt.Fprintf(&b, "<h2>%s</h2>\n", html.EscapeString(text))
			fmt.Fprintf(&b, "<h2 id='%[1]s'>%[1]s</h2>\n", html.EscapeString(text))
		case gmi.LineHeading3:
			text := string(l.(gmi.LineHeading3))
			fmt.Fprintf(&b, "<h3>%s</h3>\n", html.EscapeString(text))
			fmt.Fprintf(&b, "<h3 id='%[1]s'>%[1]s</h3>\n", html.EscapeString(text))
		case gmi.LineListItem:
			text := string(l.(gmi.LineListItem))
			fmt.Fprintf(&b, "<li>%s</li>\n", html.EscapeString(text))
I'm not sure if section IDs are useful here, since Gemini does not allow
linking to sections.