Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

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":



  • 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 or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (1)
As of 2021-07-31 19:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?