Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

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).

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://264977]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2017-11-24 09:29 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (346 votes). Check out past polls.