[pmwiki-users] Wanted: Code highlighter that works with Wiki Publisher

Patrick R. Michaud pmichaud at pobox.com
Sat Sep 23 11:17:24 CDT 2006

On Fri, Sep 22, 2006 at 05:43:26PM -0800, Joshua J. Kugler wrote:
> After trying Beautifier and SourceBlock, I have found that neither one 
> of them will work with WikiPublisher.  [...]
> Does anyone have a Syntax highlighter that will produce output 
> compatible with WikiPublisher?  Anyone willing to write one?  

I think the issue here is that this is trying to combine two
different products with incompatible goals.

The beautifier recipes such as SourceBlock and Beautifier
are based on third-party packages (beautifier and GeSHi) that
are really designed to beautify source code using HTML.
Re-using these packages is nice because the recipe author doesn't
build or maintain those capabilities, but it's pretty unlikely to
find an existing package that beautifies source code into
wiki markup "out of the box".

Of course, WikiPublisher is designed to go from wiki markup to
PDF without any intermediate HTML step, so there's not an obvious
hook for the beautifier recipes as they exist.  As I see it,
this leaves the following options:

1.  Modify GeSHi and or beautifier's output formatters to produce
    wiki markup instead of HTML.  This is likely a fair amount of
    work, since they weren't really designed for this in the first
    place, and like to depend on CSS for styling.

2.  Build an HTML-to-wiki markup translator that can convert
    the output of GeSHi or beautifier into wiki markup that can
    then be fed into WikiPublisher.  This might not be as hard
    as it would seem at first.  Having a generic HTML-to-wiki
    translator is often complex because it would need to handle
    a lot of HTML constructs yet produce wiki markup that is
    usable by human authors.  But neither of those apply here --
    we have a limited number of HTML constructs (those produced
    by GeSHI or beautifier), and we don't care if the resulting
    wiki markup looks pretty, only that it can be handled
    by PmWiki/WikiPublisher.

3.  Create a new source-code beautifier in PHP that can go
    straight to wiki markup or something that WikiPublisher
    understands.  As evidenced by the amount of work that
    goes into packages by GeSHi and beautifier, I think I can
    safely say this would be a huge amount of work with a
    limited audience.


More information about the pmwiki-users mailing list