curtvprice

Posting Code blocks in Esri GeoNet

Blog Post created by curtvprice Champion on Sep 24, 2014

UPDATE: GeoNet's code block method has changed

Place the cursor in your post where you want the code inserted.

Select More > Syntax highlighter

Choose your language (or None if plain text or the language isn't supported)

Paste your code.

Click OK.

You should see nicely highlighted code, with line numbers and colors!

You can edit the code later by selecting the code block, and selecting More > Syntax Highlighter

 

# Here is an example
import arcpy
arcpy.GetInstallInfo("desktop")["InstallDir"]

 

Alternatives ways to post preformatted text

  • Use a Monospace font

# you can change the text font to a monospace font like Courier.

(Even for just a path or variable name.)

 

  • Edit in HTML mode (click <> button at top right of formatting toolbar) and use HTML  tags:
    Preformatted text using <pre></pre>

    Preformatted text using <code></code>

Outcomes