Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Code highlighting?

by cchampion (Curate)
on Oct 06, 2004 at 17:22 UTC ( #397104=note: print w/ replies, xml ) Need Help??

in reply to Code highlighting?

As you can see form the links that other monks have provided, syntax highlighting for PerlMonks is not popular enough for the pmdev to implement such feature.

For your personal consumption, though, you may try Vim for PerlMonks nodes and On-the-fly all-languages syntax highlighting.

Comment on Re: Code highlighting?
Re^2: Code highlighting?
by radiantmatrix (Parson) on Oct 06, 2004 at 20:04 UTC

    Right that the pmdev staff should not be saddled with it. But, it seemed that there were a few people who would enjoy it. Also, it would be very helpful for new SoPW to be able to understand some of the "quickie code" laid down by the Monks.

    That's why I'm offering to do the code -- I couldn't promise that it would be done quickly, but it would be a great exercise. As long as there isn't significant opposition to the idea, and as long as users could turn it off in their preferences, it is something I'd like to do. That makes this particular discussion slightly different than previous nodes.

    My primary questions, then, are:

    • Are there any objections to implementing this?
    • Would the pmdev team roll the patches in, assuming they were done well, etc, etc.?
    • If it were done, how should it be done? IOW, what would make the monestary comfortable with the idea?
    require General::Disclaimer;

      The problem is that this isn't something you can realy opt-out of. For instance if you post code, the server should realy do the HTML markup for highlighting then (no reason to do it over and over). If the next person doesn't want highlighting then they don't use the CSS to highlight it. However even though that person didn't want the highlighting the server still went to the work to implement the code highlighting HTML.

      As I type this I had an idea though. Why doesn't PerlMonks cache a node after formating all the links and formating? As far as I could tell now it reapplies links and formating everytime the node is displayed. Why not add a feild that is identical to the content but holds the already html formated output? When edits are done it presents the original post, and when submited saves the unformated AND formated copies? This could be a huge bonus even if it saves only microseconds per post. Just thinking out loud so try not to shoot me. Anyway I'm all for CSS based syntax highlighting if it can be in a way that doesn't add huge additional load.

      Eric Hodges

      Doing this on the server would be too much load (sounds like it'd be way too much load even using existing C code implementations which don't appear to do it in a flexible enough way). And we can't do the highlighting at submit time because people use different code wrapping settings and it'd be a lot to implement caching of the highlighted code (all of that isn't impossible, but it is a whole lot of work).

      If you really want it on the server, you should probably buy a third web server first (we are pushing the current two pretty hard right now).

      There is already a client-side implementation. If you want it, use that. If it isn't good enough, improve it.

      - tye        

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (15)
As of 2014-10-30 19:14 GMT
Find Nodes?
    Voting Booth?

    For retirement, I am banking on:

    Results (208 votes), past polls