How to highlight your code

The Forum Rules, general FAQ and questions or comments about the forum are posted here.
Post Reply
Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

How to highlight your code

Post by Jorg » Thu Sep 02, 2004 8:46 pm

Hi all, I am working on the syntax highlighting module. Something went wrong :oops: but luckily I made a backup. I just needed to figure out how to do the restore

Anyway, it does not yet show how you could do the code highlight with buttons, and it is not exactly a code block (trying to fix that) but it kind of looks like this:

[syntax="c"]
if(something)
{
wxMemoryDC memdc;
wxBitmap bmp(clWid,clHei); memdc.SelectObject(bmp);
memdc.SetTextBackground((*wxWHITE));
memdc.SetTextForeground((*wxBLACK));
memdc.BeginDrawing();
}
else
SaveFile(nam+".bmp",wxBITMAP_TYPE_BMP);
[/syntax]

How to use it for now .. instead of the [ code ] block, use this (without spaces ofcourse):

[ syntax = "c" ]
// your code
[ /syntax ]

Although we are mainly c++ based, you can also choose from the following other languages:
  • ada
    apache
    asm
    css
    html
    java
    nsis
    pascal
    php
    qbasic
    sql
It is advised not to nest syntax bbcodes, it will screw up. If there are any problems contact me (Jorg). When I have the time I will try to merge it better so it will be listed in the template properly. I will also try to tweak the colors shortly so they are a bit more appealing.

Have fun!
- Jorg
Last edited by Jorg on Tue Sep 07, 2004 10:39 am, edited 1 time in total.

User avatar
tierra
Site Admin
Site Admin
Posts: 1343
Joined: Sun Aug 29, 2004 7:14 pm
Location: Salt Lake City, Utah, USA
Contact:

Post by tierra » Fri Sep 03, 2004 3:49 am

That's funny that it has some very rare languages, and not some of the biggest. Yes, I understand some are easier to code than others, but NSIS, ADA, and Apache???

Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg » Fri Sep 03, 2004 7:19 am

Maybe we can make a python one as well. It is a php script. Soon I will reinstall my pc, and also add Fedora Core 2 as my OS .. there I will run Apache and PHP/MySQL to create a shadow server to play around with new stuff for the board. Once it fails at least the community is not bothered by that :roll:

- Jorgen

User avatar
Ryan Norton
Moderator
Moderator
Posts: 1319
Joined: Mon Aug 30, 2004 6:01 pm

Post by Ryan Norton » Fri Sep 03, 2004 1:18 pm

Look good!

Mayby a bit picky but the colors might need a little tweaking - but I can live with it the way it is :).


---
Note: the post below is by me :).
Last edited by Ryan Norton on Fri Sep 03, 2004 8:11 pm, edited 1 time in total.

Guest

Post by Guest » Fri Sep 03, 2004 8:10 pm

Heh! It supports nsis :).

Also, when it says it supports c, it really means it only supports c...


[syntax="c"]
class myclass
{

virtual void myfunc();
}
[/syntax]

http://forums.wxwidgets.org/viewtopic.php?t=36

chadman
Experienced Solver
Experienced Solver
Posts: 70
Joined: Wed Mar 23, 2005 8:28 am

Post by chadman » Sat Apr 16, 2005 9:33 pm

I know this is an old thread...but how could you make syntax highlighting work in Linux if you can only make a text contorl use rich text under Windows?

eco
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 203
Joined: Tue Aug 31, 2004 7:06 pm
Location: Behind a can of Mountain Dew
Contact:

Post by eco » Sat Apr 16, 2005 11:28 pm

It's just a regular text control. The syntax highlighting only occurs after you post.

chadman
Experienced Solver
Experienced Solver
Posts: 70
Joined: Wed Mar 23, 2005 8:28 am

Post by chadman » Sat Apr 16, 2005 11:33 pm

Oh OK, so we're talking about on the web site. I thought we were talking about in a program.

Post Reply