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
| Name | Type | Description |
|---|---|---|
| w | io.Writer | Input to the operation as described above. |
| text | string | Input to the operation as described above. |
| words | map[string]string | Input 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()))}