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 a total of 53 different code languages, so yours is almost certainly among them. You can also define up to three different custom formatting sets.
The highlighter is pre-configured with standard formatting for all these languages, but you can change the formatting yourself for every element type in every language to suit your own preferences. (Note that you must do this before applying your formatting. Changing highlighting settings does not change the formatting of code that has already been highlighted.)
1.Paste your program code into your topic and select it.
2.Select the Syntax Highlighter tool in Write > Font (click on the arrow to the right of the icon to display the menu) then select the language parser you want to use from the list displayed.
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 main C:\ icon of 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 (this is already set correctly in the standard Code Example style used for syntax highlighting). 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.
•Click on the drop-down arrow next to in Write > Font, then select Customize....
Syntax highlighter settings are not styles!
Note that changing highlighting settings does not change the formatting of code that has already been highlighted. If you change your settings you must select the code again and re-apply the highlighting. Unlike styles, the syntax highlighter only applies inline formatting to selected text.
Font color and style:
You can define the font style and color for the supported elements for each highlighter language. 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).
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.
Format code samples with soft line breaks:
Uses soft line breaks instead of full paragraph breaks. Use this when you are using background color and border settings for your code samples, then line breaks will not interrupt the background and borders between lines.
If you are working in a team on the same project you will want everyone to use the same syntax highlighter settings. You can achieve this with the Load/Save Configuration button at the bottom of the Customize dialog:
Using Load/Save Configuration
•Click on the Load/Save button to save the current configuration to a file or to load a saved configuration.
•This saves ALL your syntax highlighting settings. It is not possible to save or load only individual settings.
•Loading a configuration replaces ALL the current settings with those stored in the file.
The last three code languages in the list are user-defined. You can use these to describe your own customized highlighting languages, including a list of reserved words that you can load from an external file.
Please see Syntax Highlighting for a reference to the settings you can configure there.