Skip to main content
Topic: BBcode Code Block Highlight (Read 1212 times) previous topic - next topic

BBcode Code Block Highlight

So I'm wondering if there is any secret sauce to get cpp code to syntax highlight.

Code: [Select]
for (i=0;i<4;i++){
        a+=1;
    }

Without it, I am failing to see it's value.

Any one know of a way to do this?

Re: BBcode Code Block Highlight

Reply #1
the value of code tag is to preserve indentation ... the same code you shown

Code: [Select]
for (i=0;i<4;i++){
        a+=1;
    }

if not used in code tag looks like

for (i=0;i<4;i++){
        a+=1;
    }

Re: BBcode Code Block Highlight

Reply #2
Ok, thanks! Good to know.

Re: BBcode Code Block Highlight

Reply #3
it's the html issue because html treat multiple spaces as single space hence the tabulation goes away, also html wrap lines etc etc .. on top of all default font used for site is unproportional and code looks bad in unproportional font - code tag display code using proportional font.

 

Re: BBcode Code Block Highlight

Reply #4
[quote author="arhi"]the value of code tag is to preserve indentation ... the same code you shown
if not used in code tag looks like
for (i=0;i<4;i++){
        a+=1;
    }[/quote]

and it can be optimize like this
a+=4;
:o)
...  code looks always ugly in html ...