Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Re: Feature Request: Adding Colors to Source Code

by Juerd (Abbot)
on Mar 07, 2004 at 18:23 UTC ( #334630=note: print w/replies, xml ) Need Help??

in reply to Re: Feature Request: Adding Colors to Source Code
in thread Feature Request: Adding Colors to Source Code

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

perl => sub { require Syntax::Highlight::Perl; my ($data) = @_; my $hl = Syntax::Highlight::Perl->new; $hl->define_substitution( '<' => '&lt;', '>' => '&gt;', '&' => '&amp;', "\t" => '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb +sp;', ' ' => '&nbsp;', ); $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 This code using this style sheet renders as (link dies after 30 days).

Juerd # { site => '', plp_site => '', do_not_use => 'spamtrap' }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://334630]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (11)
As of 2017-05-24 16:45 GMT
Find Nodes?
    Voting Booth?