Has anyone thought about integrating a code-to-html syntax highlighter with the <code> tags? e.g., <code style="perl">...</code>" (probably most prevalent)? I see that Code2HTML could do the heavy lifting, though the HTML it produces is kind of sub-par (not very CSS friendly), yet there's PPI::HTML which would do the same thing just for perl, but much more CSS-friendly. I'm sure there are many other examples out there that could be used (such as many of the pastebin's), too.

I don't know about you, but I spend most of my time with perl code in a syntax-highlighting editor. I find it helps me focus on structure, making it easier to zoom in on chunks. So when someone posts 70 lines of perl code, I find it more difficult to read on the site just because the computer isn't helping me decipher the code.

Now, of course if someone did this, it would need to be an option in your user settings to turn it off. The other downside would be the CPU time required for rendering this, so a cheap/fast renderer would be required, which could mean native code. I'm not saying it'd be easy, but I think it could really make some aspects of the collaborative nature of the site much nicer.


In reply to Syntax highlighting code tags by Tanktalus

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.