I like the idea, and even think it'd be good if this were enabled by default. Just not with the colours that you propose; they burn holes in my screen :)

Not everything in code-blocks is Perl source, but I see no harm in trying to render it as such. After all, only colour changes, not the text itself. Does it matter if some non-code is coloured differently?

Perhaps the Monastery could add <span> tags automatically so that people who want colours can put some colour definitions in their personal CSS. That wouldn't change anything for users that think colours are "gay".

One problem could be server load, but I don't know how well Everything caches, so I can't say much about that. I do know that on my box, Syntax::Highlight::Perl performs better than Perl::Tidy. It isn't as good, though, but I can live with the results. My Scribble service uses S::H::P, and I copied your code so you can have a look at how S::H::P does it: http://tnx.nl/scribble/765WQMX (link dies in 30 days). Colours are not hard coded, but in an external CSS file. Disable CSS and the colours are gone. Ideal, IMO.

Horrible code, by the way...

Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }


In reply to Re: syntax highlighting of code in perlmonks forums by Juerd
in thread syntax highlighting of code in perlmonks forums by aquarium

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.