Making Help Authoring a Pleasure to Do
Free DownloadStart your free trial now
Step-by-Step Guides
Tips & Tricks

How to Format Program Code with Syntax Highlighter

HelpSmith allows you to create a CHM help file, Web Help system, or PDF documentation that contains program code formatted according to the style schemes of various programming languages, such as C++, C#, Visual Basic, HTML, Java Script, PHP, Python, etc. Using the built-in Syntax Highlighter tool, you can easily copy and paste program code to a help topic and then apply a style scheme, so the code will look similarly to its appearance in the development environment (IDE) where it was originally written.

This video demonstrates how you can use the Syntax Highlighter tool to format program code that is written in different languages, such as C++, PHP, and HTML. Also please note that HelpSmith allows you to customize the syntax highlighting schemes, which means that you can change the text color and other formatting settings of individual elements in a specific programming language, such as reserved words, identifiers, comments, etc.

Below are the steps that you can follow to include and format program code in your documentation.

Step 1: Copy and Paste Code to a Help Topic

  1. Open the code in your development tool (IDE), or in a text editor.
  2. Select the code and press Ctrl+C to copy it to the Clipboard.
  3. In HelpSmith, click Write|Paste (or press the Ctrl+V shortcut) to paste the code into a topic.

Step 2: Format the Program Code with Syntax Highlighter

  1. In the topic editor, select the code that you want to format.
  2. On the Write tab, click at the bottom part (arrow icon) of the Syntax Highlighter button.
  3. In the popup menu, select the programming language which your program code is written in.

Remark: Please note that clicking on the main part of the Syntax Highlighter button applies the last-used syntax highlighting scheme to the selected program code.

Customize Syntax Highlighting Settings

You can customize text color and other formatting settings used by a specific syntax highlighting scheme:

  1. On the Write tab, click at the bottom part (arrow icon) of the Syntax Highlighter button.
  2. In the popup menu, click Customize.
  3. In the dialog, in the Available Languages list, select the programming language that you need.
  4. In the Elements, select the element whose formatting settings you want to edit. For example, you can change formatting for reserved words, identifiers, comments, and other elements.
  5. In the Style box, specify the Font Color, Background Color, and text decoration attributes.
  6. Click OK.

Thus, you can use HelpSmith to create API documentation, program specifications, help files and documents with code examples, and any other kinds of documentation containing program code written in various programming languages.

Download HelpSmith

You can download HelpSmith and start creating help files and documentation in multiple formats. For new users, HelpSmith includes sample help projects that will help you get started with the product quickly.

Detail Value
Product HelpSmith 9.9 (Build 24.523)
Filename HelpSmithSetup.exe
File size 65 MB
Platform Windows 11/10/8/7