The mozITXTToHTMLConv interface is used to convert text into HTML format. Its primary use is in converting user-entered text into properly-formatted HTML.
Inherits from nsIStreamConverter
Implemented by @mozilla.org/txttohtmlconv;1 as a service:
var ios = Components.classes["@mozilla.org/txttohtmlconv;1"]
                    .getService(Components.interfaces.mozITXTToHTMLConv);
| unsigned long citeLevelTXT(in wstring line, out unsigned long logLineStart) | 
| void findURLInPlaintext(in wstring text, in long aLength, in long aPos, out long aStartPos, out long aEndPos) | 
| wstring scanHTML(in wstring text, in unsigned long whattodo) | 
| wstring scanTXT(in wstring text, in unsigned long whattodo) | 
These bits allow you to control the conversion of text into HTML.
| Constant | Type | Description | 
| kEntities | unsigned long | Enables conversion of basic special characters to HTML entities. This applies to "<", "&", and ">" (which are converted to <,&, and>, respectively). | 
| kGlyphSubstitution | unsigned long | Enables conversion of smilies and non-ASCII special characters. | 
| kStructPhrase | unsigned long | Enables conversion of text attributes, such as converting "*some text*" to boldfaced "some text" by wrapping in the HTML <strong>element. | 
| kURLs | unsigned long | Enables automatic addition of hyperlinks for URLs in the text. | 
Scans the specified text, applying the requested conversions and outputting HTML.
wstring scanTXT(
  in wstring text,
  in unsigned long whattodo
);
textwhattodoThe HTML version of the specified string.
Scans the specified user-edited HTML, adding additional formatting that the user may not have known to do. This should correct HTML that isn't entirely standards-compliant.
kGlyphSubstitution conversion type with this method, as doing so generates HTML that is non-standard.wstring scanHTML(
  in wstring text,
  in unsigned long whattodo
);
textwhattodoA normalized version of the original HTML string.
Returns the "cite level" of the specified text; that is, it indicates how many levels of email reply quotes are used, when the text uses "quote" characters (such as ">") at the beginning of the line to indicate cite levels.
unsigned long citeLevelTXT( in wstring line, out unsigned long logLineStart );
linelogLineStartThe cite level of the quote; that is, the number of text quote characters found at the beginning of the string.
Returns the start and end offsets of the first URL found in a substring.
void findURLInPlaintext( in wstring text, in long aLength, in long aPos, out long aStartPos, out long aEndPos );
You can call this method repeatedly, passing in updated values for aPos, to locate all the URLs in a string.