Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (18)
As of 2014-07-11 19:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (235 votes), past polls