[Pmwiki-users] Syntax highlighting

J. Perkins jason
Fri Aug 29 15:30:10 CDT 2003


I have created an initial implementation of a source code syntax 
highlighter for PmWiki, based on Mike Jewell's "Beautifier" at 
http://www.beautifier.org/. Find it in the Cookbook.

This version works but it requires changes to pmwiki.php, so I can't 
recommend it for production use at this point. Still, it's pretty darn
cool... ;) I have posted it to get a discussion started on the *right* 
way to integrate this type of add-on.

The reason you have to change pmwiki.php is because there is currently 
no way (that I know of, maybe I missed something) to pull out a chunk of 
text, format it, and then stick it back into the page output. The 
highlighter needs to intercept the text before PmWiki strips the HTML 
out (because it might be HTML source code), and put it back in after 
PmWiki has finished processing markup, otherwise it might mess with the 
language syntax. I managed this by copying the behavior of the [= =] 
markup and applying it at the very start of PrintText(). Again, it works 
but it's a hack. I look forward to Pm's take on the problem.

Anyway, enjoy!

Jason
379








More information about the pmwiki-users mailing list