Documentation
¶
Overview ¶
Package htmlrtf de-encapsulates HTML from RTF that encapsulates it, as Outlook stores HTML mail ([MS-OXRTFEX]): the document declares \fromhtml1 in its header, the HTML's markup is in {\*\htmltagN ...} groups, the HTML's text is between them, and \htmlrtf ... \htmlrtf0 runs hold an RTF-only rendering that is skipped.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Result ¶
type Result struct {
// Found: the document declares \fromhtml1 in its header.
Found bool
// HTML is the de-encapsulated HTML, in the code page CodePage. It is
// empty when Found is false or when Cut is true.
HTML []byte
CodePage int
// Cut: the HTML is longer than the limit and was not kept.
Cut bool
}
Result is what Extract found.
func Extract ¶
Extract reads src, an RTF document from its opening brace. When the header declares \fromhtml1 it returns the encapsulated HTML, as long as it is at most limit bytes; past that it stops and sets Cut. Groups nested deeper than maxDepth are not read. Reading stops, without Found, at the first content of a document that does not declare \fromhtml1.