d2/lib/svg/text.go

13 lines
176 B
Go
Raw Normal View History

2022-12-22 19:06:57 +00:00
package svg
import (
"bytes"
"encoding/xml"
)
func EscapeText(text string) string {
buf := new(bytes.Buffer)
_ = xml.EscapeText(buf, []byte(text))
return buf.String()
}