user7727: You can do this (preferred):
<!-- language-all: lang-arduino -->

or this:
<!-- language-all: lang-cpp -->

to the top of every question or answer to set syntax highlighting for that entire question or answer, or this just for the code block that follows:
Code block 1: 
<!-- language: lang-arduino -->

    void setup()
    {
        Serial.begin(115200); 
        // some more code
    }

Code block 2:
<!-- language: lang-bash -->

    # random examples
    arduino-cli help core
    grep 'some regular expression' /some/file
      

but shouldn't this be turned on by default for the entire Arduino Stack Exchange instead?
Samples:
Here's what the above 2 code blocks look like, just for demonstration purposes:
Code block 1:
void setup()
{
    Serial.begin(115200); 
    // some more code
}

Code block 2:
# random examples
arduino-cli help core
grep 'some regular expression' /some/file
      

References:

Syntax highlighting language hints


user10794: Yes, but what language? Your examples shows two: C++ and bash.
Some code blocks show output from the terminal monitor which should not (generally) be coloured at all.
If you tag your question with the C++ tag that it gets the C++ (ie. Arduino) colouring automatically.

user19409: I completely agree that Syntax colouring makes the code much more readable, particularly for people who are new to coding.
I usually add the C++ language directive just above the code block to activate syntax-highlighting for the code:
<!-- language-all: lang-C++ -->

For serial monitor output, error messages and the like, you do not want syntax highlighting (but you do want it to display in the grey "code" box). You can disable the highlighting by placing this above the code block:
<!-- language-all: lang-none -->


Alternatively you could use backticks to indicate the start and end of a code block:
```cpp  
void setup()
{
    Serial.begin(115200); 
    // some more code
}
```  

will look like this
void setup()
{
    Serial.begin(115200); 
    // some more code
}

For sections where you do not want syntax highlighting, you can disable the highlighting by placing a normal code block.

The advantage of the c++ tag is that both the question and the answer get syntax hylighting without needing to add any directives.

7727: <p>You can do this (preferred):</p>
<pre><code>&lt;!-- language-all: lang-arduino --&gt;
</code></pre>
<p>or this:</p>
<pre><code>&lt;!-- language-all: lang-cpp --&gt;
</code></pre>
<p>to the top of every question or answer to set syntax highlighting for that entire question or answer, or this just for the code block that follows:</p>
<pre><code>Code block 1: 
&lt;!-- language: lang-arduino --&gt;

    void setup()
    {
        Serial.begin(115200); 
        // some more code
    }

Code block 2:
&lt;!-- language: lang-bash --&gt;

    # random examples
    arduino-cli help core
    grep 'some regular expression' /some/file
      
</code></pre>
<p><em>but shouldn't this be turned on by default for the entire Arduino Stack Exchange instead?</em></p>
<h1>Samples:</h1>
<p>Here's what the above 2 code blocks look like, just for demonstration purposes:</p>
<p>Code block 1:</p>
<pre class="lang-arduino prettyprint-override"><code>void setup()
{
    Serial.begin(115200); 
    // some more code
}
</code></pre>
<p>Code block 2:</p>
<pre class="lang-bash prettyprint-override"><code># random examples
arduino-cli help core
grep 'some regular expression' /some/file
      
</code></pre>
<h1>References:</h1>
<ol>
<li><a href="https://meta.stackexchange.com/questions/981/syntax-highlighting-language-hints/75019#75019">Syntax highlighting language hints</a></li>
</ol>
 10794: <p>Yes, but what language? Your examples shows two: C++ and bash.</p>
<p>Some code blocks show output from the terminal monitor which should not (generally) be coloured at all.</p>
<p>If you tag your question with the C++ tag that it gets the C++ (ie. Arduino) colouring automatically.</p>
 19409: <p>I completely agree that Syntax colouring makes the code much more readable, particularly for people who are new to coding.</p>
<p>I usually add the C++ language directive just above the code block to activate syntax-highlighting for the code:</p>
<pre><code>&lt;!-- language-all: lang-C++ --&gt;
</code></pre>
<p>For serial monitor output, error messages and the like, you do not want syntax highlighting (but you do want it to display in the grey &quot;code&quot; box). You can disable the highlighting by placing this above the code block:</p>
<pre><code>&lt;!-- language-all: lang-none --&gt;
</code></pre>
<hr />
<p>Alternatively you could use backticks to indicate the start and end of a code block:</p>
<pre><code>```cpp  
void setup()
{
    Serial.begin(115200); 
    // some more code
}
```  
</code></pre>
<p>will look like this</p>
<pre class="lang-cpp prettyprint-override"><code>void setup()
{
    Serial.begin(115200); 
    // some more code
}
</code></pre>
<p>For sections where you do not want syntax highlighting, you can disable the highlighting by placing a normal code block.</p>
<hr />
<p>The advantage of the <a href="https://arduino.stackexchange.com/questions/tagged/c%2b%2b" class="post-tag" title="show questions tagged &#39;c++&#39;" rel="tag">c++</a> tag is that both the question and the answer get syntax hylighting without needing to add any directives.</p>
