Documentation
¶
Index ¶
Constants ¶
const ( WIN_LBR = "\r\n" UNIX_LBR = "\n" )
Line break constants Deprecated: Please use HTML2TextWithOptions(text, WithUnixLineBreak())
Variables ¶
This section is empty.
Functions ¶
func HTML2Text ¶
HTML2Text converts html into a text form. The output is plain text, do not embed the result back into HTML without escaping.
func HTML2TextWithOptions ¶ added in v1.0.9
HTML2TextWithOptions converts html into a text form with additional options. The output is plain text, do not embed the result back into HTML without escaping.
func HTMLEntitiesToText ¶
HTMLEntitiesToText decodes HTML entities inside a provided string and returns decoded text
func SetUnixLbr ¶
func SetUnixLbr(b bool)
SetUnixLbr with argument true sets Unix-style line-breaks in output ("\n") with argument false sets Windows-style line-breaks in output ("\r\n", the default) Deprecated: Please use HTML2TextWithOptions(text, WithUnixLineBreak())
Types ¶
type Option ¶ added in v1.0.9
type Option func(*options)
Option is a functional option
func WithAllowedURLSchemes ¶ added in v1.5.0
WithAllowedURLSchemes restricts valid URL schemes (example: []string{"http", "https", "mailto"}). URLs with invalid schemes are ignored. If this option is not used, default allowed schemes are http, https, and mailto.
func WithKeepSpaces ¶ added in v1.3.0
func WithKeepSpaces() Option
WithKeepSpaces keep spaces as they are
func WithLinksInnerText ¶ added in v1.0.9
func WithLinksInnerText() Option
WithLinksInnerText instructs the converter to retain link tag inner text and append href URLs in angle brackets after the text Example: click news <http://bit.ly/2n4wXRs>
func WithListSupport ¶ added in v1.2.0
func WithListSupport() Option
WithListSupport formats <ul> and <li> lists with " - " prefix
func WithListSupportPrefix ¶ added in v1.2.1
WithListSupportPrefix formats <ul> and <li> lists with the specified prefix
func WithUnixLineBreaks ¶ added in v1.0.9
func WithUnixLineBreaks() Option
WithUnixLineBreaks instructs the converter to use unix line breaks ("\n" instead of "\r\n" default)