1

I tried using <!-- language: lang-none --> to display the output of a program without any syntax highlighting at https://stackoverflow.com/questions/29081895/c-vector-seems-to-be-overwritten-on-for-loop. However it still displayed the output like it is in some kind of language, displaying the text in various colors.

Here's a brief snippet of that text:

|A| |-| |-| |-| |-| |-| |-| |-| |-| |-|

|-| |A| |-| |-| |-| |-| |-| |-| |-| |-|

Is <!-- language: lang-none --> not supported properly, or am I using it incorrectly?

EDIT

Perhaps my browser, chrome, is responsible. Here's an image of what I see before I added this section.

enter image description here

  • 3
    I see nothing colored in that code block. You use the lang-none correctly. – ProgramFOX Mar 16 '15 at 16:50
  • Are you talking about the grey background? That's not syntax highlighting. That's always part of the rendering of a code block, syntax highlighting or no syntax highlighting. – Martijn Pieters Mar 16 '15 at 17:00
  • @MartijnPieters, No, I am talking about the colored text. The imaged I added to the question shows that. – R Sahu Mar 16 '15 at 17:01
  • Syntax highlighting is the coloring of different types of syntax in a piece of computer code to make them visually differ from other types. Like vector rendered in blue, while <string> next to it is being rendered in dark red in the C++ code. – Martijn Pieters Mar 16 '15 at 17:02
  • 1
    @RSahu: there is no colored text there. I see black text on a grey background. – Martijn Pieters Mar 16 '15 at 17:03
  • 1
    @RSahu: perhaps your display is having trouble with the vertical lines? You probably are seeing artifacts caused by the hardware of your display. – Martijn Pieters Mar 16 '15 at 17:04
  • @MartijnPieters, that very well may be the case. Let me check on a different computer. – R Sahu Mar 16 '15 at 17:07
  • Despite that it should be impossible, his screenshot at least does have colours when zoomed in. i.stack.imgur.com/kW0tV.png Probably something between his browser/OS/graphics driver is trying to do subpixel rendering shenanigans poorly? – Billy Mailman Mar 16 '15 at 17:15
1

I'm not sure what you are seeing, but that block is not syntax highlighted.

When you inspect the elements with your browser developer tools, you see:

<pre class="lang-none prettyprint prettyprinted"><code><span class="pln">|A| |-| |-| |-| |-| |-| |-| |-| |-| |-|

|-| |A| |-| |-| |-| |-| |-| |-| |-| |-|

|-| |-| |A| |-| |-| |-| |-| |-| |-| |-|

[.... elided ....]

</span></code></pre>

There are no <span> elements with tokens normally found in highlighted source code.

Compare this to the C++ code section:

<pre class="lang-cpp prettyprint prettyprinted"><code><span class="kwd">void</span><span class="pln"> </span><span class="typ">Grid</span><span class="pun">::</span><span class="pln">create</span><span class="pun">(</span><span class="typ">vector</span><span class="pun">&lt;</span><span class="typ">Aphid</span><span class="pun">&gt;</span><span class="pln"> aphidVector</span><span class="pun">,</span><span class="pln"> </span><span class="typ">vector</span><span class="pun">&lt;</span><span class="typ">Ladybug</span><span class="pun">&gt;</span><span class="pln"> ladyVector</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
</span><span class="com">// ============= Aphid initial draw section ============================</span><span class="pln">
</span><span class="typ">vector</span><span class="str">&lt;string&gt;</span><span class="pln"> vertical</span><span class="pun">(</span><span class="kwd">this</span><span class="pun">-&gt;</span><span class="pln">height</span><span class="pun">);</span><span class="pln">
</span><span class="typ">vector</span><span class="str">&lt;string&gt;</span><span class="pln"> horizontal</span><span class="pun">(</span><span class="kwd">this</span><span class="pun">-&gt;</span><span class="pln">length</span><span class="pun">);</span><span class="pln">
</span><span class="kwd">unsigned</span><span class="pln"> </span><span class="typ">int</span><span class="pln"> j</span><span class="pun">;</span><span class="pln">
string aphid </span><span class="pun">=</span><span class="pln"> </span><span class="str">"|A|"</span><span class="pun">;</span><span class="pln">
string ladybug </span><span class="pun">=</span><span class="pln"> </span><span class="str">"|L|"</span><span class="pun">;</span><span class="pln">
string empty </span><span class="pun">=</span><span class="pln"> </span><span class="str">"|-|"</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">for</span><span class="pln"> </span><span class="pun">(</span><span class="typ">vector</span><span class="pun">&lt;</span><span class="typ">Aphid</span><span class="pun">&gt;::</span><span class="typ">iterator</span><span class="pln"> aphIt </span><span class="pun">=</span><span class="pln"> aphidVector</span><span class="pun">.</span><span class="pln">begin</span><span class="pun">();</span><span class="pln">
        aphIt </span><span class="pun">!=</span><span class="pln"> aphidVector</span><span class="pun">.</span><span class="pln">end</span><span class="pun">();</span><span class="pln"> </span><span class="pun">++</span><span class="pln">aphIt</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">

    pair</span><span class="pun">&lt;</span><span class="typ">int</span><span class="pun">,</span><span class="pln"> </span><span class="typ">int</span><span class="pun">&gt;</span><span class="pln"> temp_pos </span><span class="pun">=</span><span class="pln"> </span><span class="pun">(*</span><span class="pln">aphIt</span><span class="pun">).</span><span class="pln">getPosition</span><span class="pun">();</span><span class="pln">
    </span><span class="kwd">for</span><span class="pln"> </span><span class="pun">(</span><span class="pln">j </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">;</span><span class="pln"> j </span><span class="pun">&lt;</span><span class="pln"> vertical</span><span class="pun">.</span><span class="pln">size</span><span class="pun">();</span><span class="pln"> j</span><span class="pun">++)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
        </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">j </span><span class="pun">==</span><span class="pln"> temp_pos</span><span class="pun">.</span><span class="pln">first</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
            </span><span class="kwd">unsigned</span><span class="pln"> </span><span class="typ">int</span><span class="pln"> i</span><span class="pun">;</span><span class="pln">
            </span><span class="kwd">for</span><span class="pln"> </span><span class="pun">(</span><span class="pln">i </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">;</span><span class="pln"> i </span><span class="pun">&lt;</span><span class="pln"> horizontal</span><span class="pun">.</span><span class="pln">size</span><span class="pun">();</span><span class="pln"> i</span><span class="pun">++)</span><span class="pln">
                </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">i </span><span class="pun">==</span><span class="pln"> temp_pos</span><span class="pun">.</span><span class="pln">second</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
                    horizontal</span><span class="pun">.</span><span class="pln">at</span><span class="pun">(</span><span class="pln">i</span><span class="pun">)</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> aphid</span><span class="pun">;</span><span class="pln">
                </span><span class="pun">}</span><span class="pln"> </span><span class="kwd">else</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
                    horizontal</span><span class="pun">.</span><span class="pln">at</span><span class="pun">(</span><span class="pln">i</span><span class="pun">)</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> empty</span><span class="pun">;</span><span class="pln">
                </span><span class="pun">}</span><span class="pln">

[... more elided ...]

</span></code></pre>

So apart from not showing any colors when rendered, none of the <span class"[tokentype]"> elements that normally are there to tell the browser what colors to use are not even there.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .