Using Syntax Highlighting

Updated 19 days ago ​by Jake Peters

HelpDocs comes loaded with automatic code syntax highlighting. There's nothing to set up or configure.

Whenever you include a code block, we'll automatically detect the language. Then we'll highlight the syntax appropriately for you.

To include a code block, hit the Format button in the article editor (that usually shows up as a ℙ icon) and choose Code

Here's an example:

function randomString() {
  var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
      length = 32,
      result = '';
  for (var i = length; i > 0; --i) result += chars[Math.floor(Math.random() * chars.length)];
  return result;
Code blocks are only highlighted when your articles are viewed, not when they're written. Don't worry when they look plain and boring in the article editor!

How did we do?