FormatText HTML-escapes text and writes it to w. Consecutive text segments are wrapped in HTML spans (with tags as defined by startTags and endTag) as follows:

- if line >= 0, line number (ln) spans are inserted before each line,
  starting with the value of line
- if the text is Go source, comments get the "comment" span class
- each occurrence of the regular expression pattern gets the "highlight"
  span class
- text segments covered by selection get the "selection" span class

Comments, highlights, and selections may overlap arbitrarily; the respective HTML span classes are specified in the startTags variable.

FormatText is referenced in 1 repository