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.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|