From 55acbe4ea2bdd8c8492fa88b556a78dd0e2ec578 Mon Sep 17 00:00:00 2001 From: Changkun Ou Date: Sat, 19 Sep 2020 15:51:07 +0200 Subject: [PATCH] public: more document to current implementation --- doc.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/doc.go b/doc.go index 1651e8f..b34dc29 100644 --- a/doc.go +++ b/doc.go @@ -50,15 +50,17 @@ func main() { log.Fatalf("Create: cannot create index.html, err: %v", err) } - // find TOC + // Find TOC, and remove all hard coded all back to top. Then use + // back to top button for navigation. + // + // This is urgly, I know. At least this works so far with least efforts. + // A better and generic way obviously is to do DOM tree analysis. dom := b.String() tocStart := strings.Index(dom, "

Table of Contents

") tocEnd := strings.Index(dom, `

Disclaimer

`) toc := dom[tocStart:tocEnd] dom = dom[:tocStart] + `
` + dom[tocStart:tocEnd] + `
` + dom[tocEnd:] - - // remove all hard coded all back to top, use back to top button dom = strings.ReplaceAll(dom, `

Back To Top

`, "") type data struct {