Adobe Robohelp

Get new posts delivered straight to your inbox.

Subscriber count: 3,220

Adobe Robohelp

Adding Syntax Highlighting to Code Examples Online and in Microsoft Word

Apr 4, 2013 • general

If you're integrating code examples into your technical documentation, a couple of tools can help with this. If you have an online output, you can use Code Prettify (see its Drupal version or WordPress version or regular HTML page version). This module/plugin applies syntax highlighting to your code so that it's more readable.

example

I usually replace the angle brackets with their character symbol equivalents (< and > for less than and greater than). If you leave in the angle brackets, the Prettify plugin sometimes has issues.

To get the same syntax highlighting in Microsoft Word, copy your program code into this online form to create the syntax highlight. Then paste it into Word. if you have a one-liner, add a second line to retain the number when copying and pasting, and then remove the extra line number once it's in Word.

You want the numbers in Word, by the way, because you're usually explaining what each of the line numbers means.

If you have a JSON response and want to keep the formatting clean, use something like Chrome's Advanced Rest Client app to format the JSON into readable code. Then manually copy this into your web page and apply the Prettify plugin's syntax highlight.

------------

Update: For integrating Code Prettify with Flare, see this post from Jenny Watson.


Get new posts delivered straight to your inbox.

Subscriber count: 3,220

About Tom Johnson

Tom Johnson

I'm a technical writer based in the California San Francisco Bay area. Topics I write about on this blog include technical writing, authoring and publishing tools, API documentation, tech comm trends, visual communication, technical writing career advice, information architecture and findability, developer documentation, and more. If you're a professional or aspiring technical writer, be sure to subscribe to email updates using the form above. You can learn more about me here.