Switch On The Code RSS Button - Click to Subscribe
Mar
12

Code in the Comments

We get a lot of comments here on the blog and, surprise surprise, many of them include code. You may have noticed that in all of our posts we have nicely formatted and color highlighted code - and now, anyone can use this feature in our comments. This is done simply by using formatting like the following:

[csharp]
GraphicsPath p = new GraphicsPath();
p.StartFigure();

//Top Left Corner
if ((RectangleCorners.TopLeft & corners)
    == RectangleCorners.TopLeft)
{
  p.AddArc(x, y, 2*radius, 2*radius, 180, 90);
}
else
{
  p.AddLine(x, y+radius, x, y);
  p.AddLine(x, y, x+radius;, y);
}

//Top Edge
p.AddLine(x+radius, y, x+width-radius, y);
[/csharp]

Now this will turn into:

GraphicsPath p = new GraphicsPath();
p.StartFigure();

//Top Left Corner
if ((RectangleCorners.TopLeft & corners)
    == RectangleCorners.TopLeft)
{
  p.AddArc(x, y, 2*radius, 2*radius, 180, 90);
}
else
{
  p.AddLine(x, y+radius, x, y);
  p.AddLine(x, y, x+radius;, y);
}

//Top Edge
p.AddLine(x+radius, y, x+width-radius, y);

Now this technique works for almost any language we use here on the site including:

  • csharp
  • xml
  • mxml
  • actionscript
  • javascript
  • html
  • css
  • php
For general code you can use "code", so [code]. The syntax highlighting is done using a Wordpress plugin called iG:Syntax Hiliter which uses Geshi for the highlighting. We will at some point in the future be offering up the custom files that we made for mxml and other languages. Hopefully this makes all of our commenter's lives easier.



Posted in Blog News by The Fattest |

2 Responses

  1. frederic vandenplas Says:

    can i mail it to U ?
    greetings
    frederic

  2. The Reddest Says:

    Sure, the email address is located at the bottom of the About page.

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.

Powered by WP Hashcash