Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

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 wandering the Monastery: (10)
As of 2017-02-25 17:04 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (366 votes). Check out past polls.