Documentation
¶
Overview ¶
Package text reads text documents as UTF-8, from whatever character set they're in, and writes plain text as Markdown, so it's shown as it is
Index ¶
Constants ¶
const ( // MaxBytes is the most of a text document which is read, as the // document is decoded, or parsed, in memory. A larger document is read // up to this size. MaxBytes = 16 << 20 )
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
Decode returns the text as UTF-8, from the character set of its byte order mark, or UTF-8 when it's valid UTF-8, or else Windows-1252. When the text was cut off, a character cut off at its end is removed first, so it isn't read as invalid UTF-8.
func Escape ¶
Escape returns the text as Markdown within a line, such as a cell of a table, with its characters which are Markdown escaped, and its line breaks and tabs as spaces
func PlainText ¶
PlainText returns text which may be HTML, such as a description, as plain text, without its tags, with its entities decoded, and its spaces collapsed
func Read ¶
Read returns at most MaxBytes of the text as UTF-8, from the character set of its byte order mark, or UTF-8 when it's valid UTF-8, or else Windows-1252
func WriteMarkdown ¶
func WriteMarkdown(w io.StringWriter, text string) error
WriteMarkdown writes the text as Markdown, a line at a time, so it's shown as it is: its characters which are Markdown are escaped, its line breaks are kept, a blank line separates its paragraphs, and its indentation is kept without the line being code. It stops when a write returns an error.
Types ¶
This section is empty.