Code highlighting

I've added some support for code samples highlight in the posts. I use CSS so any highlighting is only visible on the web page of the blog. I would really like to make automatic it in RSS and Atom feeds, but I'm not yet sure how to do it correctly.

One solution would be to add link to the CSS with rules on highlighting. I'm not very fond of this solution as the blog client application would attempt to access the webpage to get CSS file and there might be no Internet connection available. Another solution would be to embed current rules into the post when RSS or Atom XML is generated. In either case I need to modify XML generation process and that might be tricky. I will look into doing it sometime soon, but to be truthful I'm not 100% sure I will be able to implement it. In that case I will need to find another solution (like falling back to <code> and <pre> tags instead of using classes).

Above paragraph has an example of the inline code (inline code is just bold). Bellow is example of a code block. It's the CSS code I use for highlighting.

.ic { display: inline; font-weight: bold; } .code { display: block; border: 1px solid #D0D0D0; padding: 10px; background-color: #F4F4F4; white-space: pre; }


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: Slava
Posted on: 8/7/2005 at 7:30 PM
Categories: General
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Related posts

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

Tuesday, January 06, 2009 7:51 AM