Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.

Re^2: Code highlighting?

by radiantmatrix (Parson)
on Oct 06, 2004 at 20:04 UTC ( #397154=note: print w/replies, xml ) Need Help??

in reply to Re: Code highlighting?
in thread Code highlighting?

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;

Replies are listed 'Best First'.
Re^3: Code highlighting?
by eric256 (Parson) on Oct 06, 2004 at 21:48 UTC

    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
Re^3: Code highlighting?
by tye (Sage) on Oct 07, 2004 at 16:27 UTC

    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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://397154]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2023-11-30 13:27 GMT
Find Nodes?
    Voting Booth?

    No recent polls found