1
0

update documentation

This commit is contained in:
Arpad Ryszka 2025-11-03 02:56:53 +01:00
parent 4a91472c74
commit c4773eb94f
2 changed files with 10 additions and 1 deletions

9
lib.go
View File

@ -348,6 +348,9 @@ func Void(t Tag) Tag {
// Non-tag child nodes are rendered via fmt.Sprint. Consecutive spaces are considered to be so on purpose, and // Non-tag child nodes are rendered via fmt.Sprint. Consecutive spaces are considered to be so on purpose, and
// are converted into  . Spaces around tags, in special cases, can behave different from when using // are converted into  . Spaces around tags, in special cases, can behave different from when using
// unindented rendering. // unindented rendering.
//
// It returns an error only when either one or more tags are invalid, or the underlying writer returns an
// error.
func WriteIndent(out io.Writer, indent Indentation, t ...Tag) error { func WriteIndent(out io.Writer, indent Indentation, t ...Tag) error {
if indent.PWidth < indent.MinPWidth { if indent.PWidth < indent.MinPWidth {
indent.PWidth = indent.MinPWidth indent.PWidth = indent.MinPWidth
@ -383,11 +386,17 @@ func WriteIndent(out io.Writer, indent Indentation, t ...Tag) error {
// Write renders html with t as the root nodes with the default indentation and wrapping. Tabs are used as // Write renders html with t as the root nodes with the default indentation and wrapping. Tabs are used as
// indentation string, and a paragraph with of 120. The minimum paragraph width is 60. Indentation and width // indentation string, and a paragraph with of 120. The minimum paragraph width is 60. Indentation and width
// concerns only the HTML text, not the displayed document. // concerns only the HTML text, not the displayed document.
//
// It returns an error only when either one or more tags are invalid, or the underlying writer returns an
// error.
func Write(out io.Writer, t ...Tag) error { func Write(out io.Writer, t ...Tag) error {
return WriteIndent(out, Indentation{Indent: "\t"}, t...) return WriteIndent(out, Indentation{Indent: "\t"}, t...)
} }
// WriteRaw renders html with t as the root nodes without indentation or wrapping. // WriteRaw renders html with t as the root nodes without indentation or wrapping.
//
// It returns an error only when either one or more tags are invalid, or the underlying writer returns an
// error.
func WriteRaw(out io.Writer, t ...Tag) error { func WriteRaw(out io.Writer, t ...Tag) error {
return WriteIndent(out, Indentation{}, t...) return WriteIndent(out, Indentation{}, t...)
} }

View File

@ -19,7 +19,7 @@ import (
) )
func main() { func main() {
html.RenderIndent( html.Write(
os.Stdout, os.Stdout,
html.Indent(), html.Indent(),
Doctype("html"), Doctype("html"),