Syntax::Highlight::Perl - but Im not sure its a good idea..
I think it is a very good idea, as long as it is a user setting and done using CSS. I know I would love and enable the feature as soon as I can.
Here is the code I use at http://tnx.nl/scribble.plp:
perl => sub {
require Syntax::Highlight::Perl;
my ($data) = @_;
my $hl = Syntax::Highlight::Perl->new;
$hl->define_substitution(
'<' => '<',
'>' => '>',
'&' => '&',
"\t" => ' &nb
+sp;',
' ' => ' ',
);
$hl->set_format( $_ => [ "<span class=$_>", "</span>" ] )
for qw/Comment Directive Label Quote String Subroutine
+ Variable
Keyword Builtin Operator Package Number CodeTer
+m Symbol
DATA/;
return '<link rel=stylesheet href="/perl.css"><pre>' .
$hl->format_string($data) . '</pre>';
},
I use this together with http://tnx.nl/perl.css. This code using this style sheet renders as http://tnx.nl/2240IXCX (link dies after 30 days).
-
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.
|