Embedded Components and Tools Blog Center

May 29, 2007

How to build Dean Lee’s Syntax Highlighter from latest components

Filed under: Component Projects,Component Technology,Web Components,WordPress — Ron Fredericks @ 1:06 am

[tag]Ron Fredericks[/tag] writes: In my last two posts:

During my research to solve the word wrap problem, I discovered a few more issues leading me to update Dean’s plugin with the latest version of GeSHI (an open-source project: Generic Syntax Highlighter for php. Highlight many languages, including PHP, CSS, HTML, SQL, Java, Assembler, and C for XHTML compliant output) and removal of unused files. I thought other WordPress bloggers might like to take advantage of the latest code too, so I document the steps needed to build a clean [tag]plugin[/tag] with the latest [tag]component[/tag]s.

[tag]Flow Chart[/tag] / [tag]Swim Lanes[/tag] Widget
Below is a [tag]Flash[/tag] [tag]widget[/tag] I built to document the steps needed so you can roll your own up-to-date plugin. Follow these steps and you won’t have to be a programmer to get the benefits from the latest versions of these program components. The widget actively links to the latest [tag]PHP[/tag] files and [tag]CSS[/tag] classes:

[flash https://www.embeddedcomponents.com/wp-content/uploads/2007/05/how2installplugin.swf w=450 h=583]

(more…)

May 27, 2007

How to Fix Dean Lee’s Source Code Highlight Plugin

Filed under: WordPress — Ron Fredericks @ 12:52 am

[tag]Ron Fredericks[/tag] writes: In my previous post, I discuss [tag]Dean Lee[/tag]’s [tag]source code[/tag] [tag]syntax highlighting[/tag] [tag]plugin[/tag] for [tag]Wordpress[/tag]. It delivers all the great features of the [tag]GeSHi[/tag] [tag]open-source[/tag] highlight project for Wordress bloggers.

Yet some source code displayed badly – turning a developer’s nice clean style into a chaotic and messy format. I demonstrated the display problem using a perl sendmail script I plan to discuss in a future blog post. The problem had to do with some kind of whitespace word wrap issue.

I tested various features of CSS and DIV tag attributes created by Dean’s plugin and the GeSHi php code. I am happy to say, I found a simple one-line solution. My solution is in updating Dean’s CSS container class to force white space not to wrap.

Here is my solution:
Add this property to Dean’s “ch_code_container” CSS class:

white-space: nowrap;

(more…)

May 25, 2007

How to Display Source Code Within WordPress

Filed under: WordPress — Ron Fredericks @ 10:11 am

Ron Fredericks writes: I have a problem in common with many software engineers and technical managers – “How can I display source code within my blog?”

See, the problem starts when the source code to be displayed interacts with the blogging software itself and then corrupts the blog’s own loop-and-display engine. Thus, the blog page becomes corrupt or at the very least, becomes mis-formatted and hard to read. Of course it would also be nice to color code a software snippet similar to a source code editor to make the posted source code easier to read.

I tried several techniques during my Internet search for “WordPress source code formatting”. I discovered a common theme – there are source code display and highlighting methods available – in fact too many are available. So the search became a “needle in the haystack” time sink. And the sad fact, most choices have some severe limitations.

But at last, I found Dean Lee’s blog post: Source Code syntax highlighting plugin for WordPress (V1.1)

Dan’s pluglin for WordPress has all the features I was looking for:

  • installs as a simple plugin for WordPress
  • usage within a blog post is easy through the use of the pre tag
  • source code displays in its own container with line numbers for reference
  • a reader should be able to easily select a range of displayed source code and copy it for their own use (without also selecting the displayed line numbers)
  • source code display should not break my WordPress blogging software

(more…)

Powered by WordPress