Standard library / go/doc/comment
go/doc/comment.Heading.DefaultID()
Computes a heading anchor using ASCII letters and digits, replacing other runes with underscores. Expected stdout: 'hdr-Go_Tools\n'.
Formal Syntax & Structure
go syntaxgo
func (h *Heading) DefaultID() stringReturn Value
string
Computes a heading anchor using ASCII letters and digits, replacing other runes with underscores.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/doc/comment")
func main() { h := comment.Heading{Text: []comment.Text{comment.Plain("Go Tools")}} fmt.Println(h.DefaultID())}