This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] How do I add a code snippet to my post?

Expert 5020 points

Replies: 0

Views: 762

  1. After following the steps to begin authoring a technical question in E2E as described in this [FAQ] How do I ask a technical question in E2E?  when in the Description section of the editor you can add snippets of code to the post using the Insert code using Syntaxhighlighter button indicated in the image below:

2.  After clicking the Insert code with Syntaxhighlighter button you will see the following form with several options:

If you're using a visual code editor like Visual Studio, be sure that your the code snippet you've copied is text only before pasting into the Past Code box.

What do the various options mean?

Choose Language

Select using a drop down which programming language you will be pasting. The default option is C and C++.

Highlight
Insert which (if any) rows of code you would like to highlight.

Example: If you wanted to highlight row 5. You would simply type into the box here: 5

If you wanted to highlight multiple rows of code you would enter: 5, 10, 15, 20, 25
Enter each row with a comma to separate them into the box.

Gutter
Allows you to turn gutter with line numbers off.

Light
If you check the box for "Light" it will remove the code row numbering and vertical bar. So in the example below if you had "Light" checked you would not see the code row numbering (1-10) on the far left or the green vertical bar.

  

With "Light" checked it would then look like:

Collapse
Collapse your code for display purposes.

HTML Script
For posting HTML code.

First Line and Font Size
Indicate which line you want a corresponding increased or decreased font size to appear. 

Re-collapsing Code

To re-collapse code, refreshing the page using the F5 key (can vary by browser) re-collapses the code.

Bill Traynor
E2E SysAdmin/DevOps