Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2020-06-02 11:55 GMT
Find Nodes?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?

    Results (17 votes). Check out past polls.