What's hot ? (and I mean really ...) - scroll down for more
1).  Code Templating - advanced usage of delegates & generics: my slides & demos are available for download! CodeProject article is also available.

2).  My series "TDD in the eyes of a simpleminded" is in progress(including code!): preface, part1, part2, Q&A 1, Manual Stub .vs. Mock Stub

3).  TDD Workshop: SeeCompass v0.1 and v0.2 are out.
# Wednesday, February 01, 2006

I'm using dasBlog "Insert Code" feature in order to insert some code to the post(strange, but true). Until now, my code was nicely highlighted but it was lacking of background color and some border to give it the proper attention it was required. After digging for couple of seconds in the dasBlog directory I found out that the page ftb.insertcode.aspx (under ftb directory) is in charge of highlighting the code. Here are the important lines (Notice the background color & border ! :-)):

void parseButton_Click(object sender, EventArgs e)
{
   AylarSolutions.Highlight.Highlighter h = new AylarSolutions.Highlight.Highlighter();
   h.ConfigurationFile = Server.MapPath("CodeHighlightDefinitions.xml");
   h.OutputType = AylarSolutions.Highlight.OutputType.Html;
   string result = h.Highlight(sourceTextBox.Text, languageDropDown.SelectedValue);
   result = result.Replace("\t", "    ");
   result = result.Replace(Environment.NewLine, "<br>");
   resultLabel.Text = result;
   codeText.Text = "<p>" + result + "</p>";
}

All you have to do is replace the line:

codeText.Text = "<p>" + result + "</p>";

With this:

codeText.Text = "<p class='HighlightedCode'>" + result + "</p>";

Now add the class into your template css and that's it!

* I'm using:

.HighlightedCode
{
    border-style: dashed;
    border: 1px Silver;
    background-color: White;
    margin-left: 10px;
    margin-right: 10px;
    margin-bottom: 10px;
    margin-top: 10px;
    padding-left: 4px;
    padding-right: 4px;
    padding-bottom: 4px;
    padding-top: 4px;
}

Sweeeeet !
Posted by Oren Ellenbogen 
01/02/2006 05:18, Israel time UTC+02:00,     Comments [0]  |  Related posts:
Syndicate bug(?) with dasBlog
Congratulations, you've installed dasBlog!

Comments are closed.