Standard library / go/doc

go/doc.ToHTML()

Legacy comment-to-HTML conversion without package-aware doc links; prefer Package.HTML. Expected stdout: '<p>Hello\n'.

Formal Syntax & Structure

go syntaxgo
func ToHTML(w io.Writer, text string, words map[string]string)

Parameters & Attributes

NameTypeDescription
wio.WriterInput to the operation as described above.
textstringInput to the operation as described above.
wordsmap[string]stringInput to the operation as described above.

Working Example

Example Snippetgo
package main
import (  "bytes"  "fmt"  "go/doc"  "strings")
func main() {  var b bytes.Buffer  doc.ToHTML(&b, "Hello", nil)  fmt.Println(strings.TrimSpace(b.String()))}
Go Reference