| | |
Syntax language can be highlighted
![]() |
Hey guys! Just what you've been waiting for ... You can now specify a language within your code bbcode to use syntax highlighting just like in our code snippet library.
For example ... Just do [code=c] ...
Additionally, you can use the noparse bbcode when you don't want bbcode to be parsed. For example ... [b]Hi[/b] ... notice that [b] wasn't parsed into bold despite a matching close tag and no funky spaces thrown in.
For example ... Just do [code=c] ...
c Syntax (Toggle Plain Text)
printf("Hello World\n");
Additionally, you can use the noparse bbcode when you don't want bbcode to be parsed. For example ... [b]Hi[/b] ... notice that [b] wasn't parsed into bold despite a matching close tag and no funky spaces thrown in.
Last edited by cscgal; Oct 24th, 2006 at 9:36 pm.
Dani the Computer Science Gal 
Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds

Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds
Excellent!!!
If I may humbly suggest a few visual suggestions, though:
To follow more closely what I've seen:
comments in green
"Strings" and 'characters' in blue
Numbers in dark blue
Keywords in bold purple (no underline)
All else is black
C/C++ functions don't need to be colored, but if they are, use a dark color like maybe red
All the colors should be of a similar intensity. The switch from the keyword-yellow to function-underline/blue is too striking.
I also notice in the [code=c] section, there is no formatting displayed in the edit window. I assume that's just a glitch, but I thought I'd at least point it out, just in case.
Also, is there a possibility to close up the gap between lines just a tad -- at least as a test? I'd like to see a little less space and a little more code. Instead of 1.5 spacing maybe 1.25.
If I may humbly suggest a few visual suggestions, though:
c Syntax (Toggle Plain Text)
#include <stdio.h> #include <ctype.h> char* Word[]= { "Alpha ", "Bravo ", "Charlie ", "Delta ", "Echo ", "Foxtrot ", "Golf ", "Hotel ", "India ", "Juliet ", "Kilo ", "Lima ", "Mike ", "November ","Oscar ", "Papa ", "Quebec ", "Romeo ", "Sierra ", "Tango ", "Uniform ", "Victor ", "Whiskey ", "X=ray ", "Yankee ", "Zulu " }; int main() // This is a comment { char inbuf[200]; char *p; int i; printf("Enter: "); fgets(inbuf, 200, stdin); p = inbuf; while (*p) { if (isupper(*p)) { i = *p - 'A'; printf("%s", Word[i]); } else if (islower(*p)) { i = *p - 'a'; printf("%s", Word[i]); } else { putchar(*p); } p++; } return 1; }
comments in green
"Strings" and 'characters' in blue
Numbers in dark blue
Keywords in bold purple (no underline)
All else is black
C/C++ functions don't need to be colored, but if they are, use a dark color like maybe red
All the colors should be of a similar intensity. The switch from the keyword-yellow to function-underline/blue is too striking.
#include <stdio.h>
#include <ctype.h>
char* Word[]= { "Alpha ", "Bravo ", "Charlie ", "Delta ", "Echo ",
"Foxtrot ", "Golf ", "Hotel ", "India ", "Juliet ",
"Kilo ", "Lima ", "Mike ", "November ","Oscar ",
"Papa ", "Quebec ", "Romeo ", "Sierra ", "Tango ",
"Uniform ", "Victor ", "Whiskey ", "X=ray ", "Yankee ",
"Zulu "
};
int main() // This is a comment
{
char inbuf[200];
char *p;
int i;
printf("Enter: ");
fgets(inbuf, 200, stdin);
p = inbuf;
while (*p)
{
if (isupper(*p))
{
i = *p - 'A';
printf("%s", Word[i]);
}
else
if (islower(*p))
{
i = *p - 'a';
printf("%s", Word[i]);
}
else
{
putchar(*p);
}
p++;
}
return 1;
}
Also, is there a possibility to close up the gap between lines just a tad -- at least as a test? I'd like to see a little less space and a little more code. Instead of 1.5 spacing maybe 1.25.
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
Or how about 1.00...
But WaltP's colors are all wrong. Yours are better. (Mine are the best. No you can't have them
)
I know! Let's through obscure languages at the feature!
It doesn't look like you have Haskell highlighting yet.
Well at least you have Scheme. But the highlighting is broken, since it treats display and newline like keywords, when they're just built-in procedures.
But WaltP's colors are all wrong. Yours are better. (Mine are the best. No you can't have them
)I know! Let's through obscure languages at the feature!
haskell Syntax (Toggle Plain Text)
factorial 0 = 1 factorial n = n * factorial (n - 1)
It doesn't look like you have Haskell highlighting yet.
scheme Syntax (Toggle Plain Text)
((call/cc call/cc) (lambda (f) (display "Hello, world!") (newline) (f f)))
Well at least you have Scheme. But the highlighting is broken, since it treats display and newline like keywords, when they're just built-in procedures.
All my posts may be redistributed under the GNU Free Documentation License.
![]() |
Similar Threads
- syntax (Computer Science)
- basic commands and syntax in c language (C)
- c language definition, commands and syntax of each command for beginners (C)
Other Threads in the IT Professionals' Lounge Forum
- Previous Thread: Information Delivery - Creating a GUI?
- Next Thread: Certifications? 4 Year Degree? Both?!
| Thread Tools | Search this Thread |
1gbit advertising advice amazon answers archive british broadband business businessprocesses career carrier censorship cern china cio collectiveintelligence connectivity consumer consumers corporateearnings datatransfer debtcollectors dictionary digg digital ebay ecommerce email employment environment facebook food government grid high-definition hottub infodelivery infotech intel internet interview ipod isp japan kindle lhc library malware marketing mit moonfruit news onlineshopping piracy piratebay pope porn program questions r&d religion remoteworking research retail security sex shopping simple skype smallbusiness smb sms socialmedia socialnetworking software softwareengineer spam speed spending startrek statistics stocks study stumbleupon survey tabletpc technology touch-screen touchscreen twitter uk videoinprint voips web webdeveloper windows words






