Select to view content in your preferred language

Posting code with Syntax Highlighting on GeoNet

4579
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
BlakeTerhune
MVP Regular Contributor

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.

ZacharyHart
Honored Contributor

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.

DanPatterson_Retired
MVP Emeritus

and to tie in all the links...

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

Version history
Last update:
‎08-23-2016 09:08 AM
Updated by:
Contributors