Using Syntax Highlighting

HelpDocs comes loaded with automatic code syntax highlighting. There's nothing to set up or configure—it'll automatically highlight your code based on the language you insert.

Adding Syntax Highlighting

  1. Paste in your code block
  2. Highlight the code block
    1. In the text editor, click the Format button (ℙ icon)
    2. Scroll down and select Code (not inline code)
  3. Hit Save

Now your code will look beautiful and readable to all those developers out there. 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!

What did you think of this doc?