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?
Answer
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 (http://alexgorbatchev.com/SyntaxHighlighter/) which produces the output shown below when I render an article containing code:
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:
http://bobbuzzard.blogspot.co.uk/2014/01/syntax-highlighting-in-knowledge.html
Attribution
Source : Link , Question Author : Dmitry Nikolaev , Answer Author : Bob Buzzard