Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: syntax highlighting of code in perlmonks forums

by hbo (Monk)
on Jun 11, 2003 at 07:39 UTC ( #264977=note: print w/ replies, xml ) Need Help??

in reply to syntax highlighting of code in perlmonks forums

Parsing Perl well enough to do a good job of syntax highlighting is hard. The ony program I've seen that seems to get it right all the time is perltidy. It's 20,000 lines of Perl, most of which aren't concerned with syntax highlighting. But that gives a sense of the scale of the problem.

So, let's say you had a special tag, <perl_code> has been suggested here, that would run the tag contents through perltidy --html. The highlighting is implemented with a CSS stylesheet, which could be incorporated into the standard site CSS. To turn off the highlighting, or to implement your own style, just add a custom stylesheet.

Of course, it would still be a significant load on the server(s).

Comment on Re: syntax highlighting of code in perlmonks forums
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://264977]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2016-04-29 04:02 GMT
Find Nodes?
    Voting Booth?
    :nehw tseb si esrever ni gnitirW

    Results (438 votes). Check out past polls.