[wp-hackers] Pimping the theme/plugin editors

Stephen Rider wp-hackers at striderweb.com
Sat Jun 16 15:23:59 GMT 2007


On Jun 16, 2007, at 6:37 AM, Leonid Mamchenkov wrote:

> On 6/16/07, Jeremy Visser <jeremy.visser at gmail.com> wrote:
>> Leonid Mamchenkov wrote:
>> > There is a need for better <code>...</code> handling. With syntax
>> > highlighting, file captions, line numbers, etc.
>>
>> CodePress looks like a client-side JavaScript syntax highlighter.  
>> What
>> you're referring to within <code> tags would be handled server-side.
>
> CodePress front page says: " CodePress is web-based source code editor
> with syntax highlighting written in JavaScript that colors text in
> real time while it's being typed in the browser."
>
> Web-based.
>
> Also, installation instructions at http://codepress.org/install.php
> say that one should download the script and install it on a webserver.

Jeremy is correct.  You'll note that Codepress also says that it is  
entirely JavaScript, and can be tested on a local machine without a  
server.

> Sounds to me like an excellent thing to be integrated with WordPress.
> Both standalone and WordPress.com hosted.
>
> I see it as a [code] button in the editor.  I press it, I get to edit
> some code with CodePress (either in a popup window, or in another
> textarea, or whatever), and then I click something like [Copy to post]
> to get the formatted and highlighted code that I wrote into my post.

That's exactly how I see it.  You click on the code button and a  
window pops up with a textarea and the row of Language buttons along  
the top.  You type in your code, then hit "okay" and the code --  
converted to HTML entities and marked up for formatting -- is pasted  
back into the post.

I don't think CodePress's "Get code" function actually returns the  
"formatted" code, so some voodoo would have to happen there to get  
the formatted code back to the post edit screen.  Also, the Codepress  
CSS files would have to be integrated into the WordPress CSS that  
displays with posts.

This might be better as a plugin instead of rolling into core, since  
most bloggers probably never go near displaying code in posts.

*****
RELATED QUESTION: Can anyone direct me to some instruction on writing  
a plugin that adds a button to the post editor?  I've found a  
different plugin that adds posts to the HTML editor*, but since  
ButtonSnap stopped working I can't find a way to add buttons to the  
Rich Text editor.

Also, instruction or hints about using a plugin to add buttons that  
do custom actions -- like the "Link" button that pops up a dialog to  
fill in?
*****

* Here's that plugin I mentioned:
<http://babelfish.altavista.com/babelfish/trurl_pagecontent? 
lp=de_en&trurl=http%3A%2F%2Fbueltge.de%2Fwp-addquicktags-de-plugin% 
2F120%2F>

or <http://bueltge.de/wp-addquicktags-de-plugin/120/>

Regards,
Stephen Rider


More information about the wp-hackers mailing list