Syntax highlight in Knowledge articles

We are planning to move our current knowledge base to Salesforce Knowledge. One of the main concerns is that we have tons of sample code in different languages (C#, JavaScript, VB, Delphi) and it seems that SF Knowledge does not provide a built-in syntax highlight feature.

Does anyone know whether there is a way to add syntax highlight for code contained in a Salesforce Knowledge article?


You can’t do this using any built-in functionality of Salesforce knowledge, but you can use an external JavaScript syntax highlighter in conjunction with a Visualforce page to display the knowledge article.

I’ve integrated Alex Gorbatchev’s Syntax Highlighter ( which produces the output shown below when I render an article containing code:

enter image description here

This is using the java brush – you may find you prefer one of the others.

I’ve written up how to achieve this in a blog post at:

Source : Link , Question Author : Dmitry Nikolaev , Answer Author : Bob Buzzard

Leave a Comment