Posting code with Syntax Highlighting on GeoNet

2378
3
08-23-2016 09:08 AM

Posting code with Syntax Highlighting on GeoNet

When you post code, expand the toolbar:

In the expanded toolbar, click more and Syntax highlighter:

Select the language (for instance Python):

 

Paste you code:

 

Click OK in the lower part of the screen

 

And the code will appear with the correct format:

Comments

I would also like to point out that you can't edit a code block in place. You have to left click in it to select the block, then repeat the steps above to open the syntax highlighter.

I'd like to also add suggestion of copying your code to something like notepad or notepad++ to deal with spacing/wraparound and then past it back into the codeblock per Dan Pattersonsuggestion in comments found here.

and to tie in all the links...

/blogs/dan_patterson/2016/08/14/script-formatting 

Version history
Revision #:
1 of 1
Last update:
‎08-23-2016 09:08 AM
Updated by:
 
Contributors