Unit
HtmlHighlight (add U suffix for Unicode version)
Declaration (partial)
type
TCustomExtHighlighter = class(TPlusHighlighter);
THtmlHighlighter = class(TCustomExtHighlighter);
Description
THtmlHighlighter is a non visual component to dynamically highlight html language elements in a TPlusMemo. Various parts of html tags are highlighted independently, for example the bracket pair, the attribute values and strings can have their own highlighting, different from the html keyword. Html comments and script sections are also highlighted differently.
To use this component, place a THtmlHighlighter on a form or datamodule, set your TPlusMemo.Highlighter property to point to it, et voilà, html tags are turned colored, underlined, bolded, as you want. You can control the highlighting attributes for different parts of html tags from within the Object Inspector. This effect is best appreciated if some html text is loaded in the TPlusMemo (via its Lines property), and watching how the highlighting changes when changing various properties in the Object Inspector.
Key properties
| Bracket | A THighlightInfo object to control the highlighting of opening and closing brackets (<>) | |
| DefaultText | A THighlightInfo object present for compatibility with previous versions. | |
| HtmlAttribute | A THighlightInfo object to control highlighting of attribute names in tags. | |
| HtmlAttributeValue | A THighlightInfo object for the attribute values in tags. | |
| HtmlComment | A THighlightInfo object for html comments (<!-- ... -->). | |
| HtmlKeyword | A THighlightInfo object for html keywords. | |
| HtmlTag | A THighlightInfo object for parts of html tags that are not keywords, attribute names or attribute values. | |
| Keywords | A TExtKeywordList object for defining additional html elements over those of HTML3.2. | |
| PerlScript | A THighlightInfo object for perl sections (<? ... ?>). | |
| ScriptContent | A THighlightInfo object for script sections (<% ... %> and <SCRIPT ...>...</SCRIPT>. | |
| ScriptTag | A THighlightInfo object for script tags (<SCRIPT ...>) | |
| SpecialChars | A THighlightInfo object for special character entities like and Ѕ | |
| SubHighlighter | A TPlusHighlighter component for further highligting inside tags, comments or scripts. | |
| UnknownTag | A THighlightInfo object for unrecognized html tags. | |
| XMLSyntax | A Boolean property, if True, there are no unrecognized html commands, they are all highlighted like valid ones. |