Examples of program source code are much easier to read if reserved words, comments, identifiers and so on are highlighted as they are in a modern programming editor. Help & Manual's Syntax Highlighting function does this for you. It understands the syntax of Pascal, C++, C#, Visual Basic, ANSI SQL and Visual Objects. It knows the reserved words of these languages and can distinguish between plain text, comments, strings, numbers and even compiler directives, where they are supported. You can also add your own reserved words.
Once you have chosen a language parser it is set as the default until you select a different language. You can then select it directly by clicking on the Syntax Highlighter tool in the Ribbon. |
The syntax highlighter uses a standard style called Code Example for the font and paragraph attributes. By default this style is set to Courier New, 8 points, no word wrap and keep paragraph lines together. You cannot delete or rename this style but you can edit it. Just position the cursor in a piece of text formatted with the syntax highlighter and select Styles > Edit Styles in the Write tab to open the style editing dialog with the Code Example style selected. See Editing styles for details. |
Program code is often automatically indented with leading spaces. To get this to display correctly you just need to turn word wrap off in the paragraph settings of your code examples, either manually or with a style. Then all the spaces will be converted to hard space entities which will render correctly in all browsers. Paragraphs will not wrap, but you don't want paragraphs to wrap in program code. In paragraphs with word wrap turned on Help & Manual converts multiple spaces to alternating soft and hard space characters – otherwise browsers would interpret multiple spaces as a single space. However, this will often not render quite right because different browsers interpret the width of these hard/soft space combinations in different ways. |
Font color and style: You can define the font style and color for the supported elements for each language parser. To change the standard syntax highlighting font face click on Edit Style and edit the Code Example style that is used automatically by the syntax highlighter (see above). Loading your own reserved words: You can add your own reserved words to the lists used by the syntax highlighter or completely replace the highlighter's lists with your own lists:
Restoring the default settings: Clicking on Reset Defaults restores all the syntax highlighter's settings for the current language to Help & Manual's default values, including the list of reserved words. |
See also:
Page url: http://www.helpandmanual.com/help/index.html?hm_working_formatting_syntax.htm