Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Syntax highlighting for CPAN

by ELISHEVA (Prior)
on Mar 24, 2011 at 10:00 UTC ( #895211=perlnews: print w/replies, xml ) Need Help??

CPAN has a new feature on CPAN: Syntax highlighting!

If you scroll down to the very bottom of each CPAN documentation page, right above the footer you should see a drop-down box labeled "Syntax Highlighting". The drop down box gives you a choice of color schemes.

If you don't see the box at first, be sure to do a complete page refresh. The box is a new feature and may not be visible if your cache is stale.

Also make sure you are all the way down at the bottom on the page. The drop down box is attached to the footer, not the bottom of the browser window. I haven't tried them all, but so far I like the level of contrast with berries-light. YMMV of course.

For more information, see Syntax Highlighting for CPAN.

Note: this announcement is thanks to jmcnamara who alerted us to this feature today in the cb but didn't have time to write up a Perl News item and asked if someone would do it for him.

Replies are listed 'Best First'.
Re: Syntax highlighting for CPAN
by jmcnamara (Monsignor) on Mar 24, 2011 at 10:13 UTC
    Delegation is great. Someone should write an article about it for me. :-)

    This is a really nice addition to Well done to everyone involved.

    At the moment I've settled on vim-dark. It may offend thine eyes but it works for me.


      Thank you, ...

      ...but do you know why it's necessary to use yet another syntax parser for Perl?

      The quality is below perltidy -html (i.e. w/o reformating), e.g. if you look at the bottom of you will see the hash key -values highlighted.³

      Thats not much better than the pure JS solution that Corion already proposed for perlmonks¹, which could easily be adopted for CPAN and automated using scriptmonkey.

      Talking about automation, I couldn't find an option to save highlighting as default (e.g. in cookie).²

      Sorry if I may sound overly negative, I really appreciate the effort!

      It's just my mentality to ask for insight and discuss other solutions.

      Cheers Rolf

      1) see Free Nodelet hack: Syntax colouring

      2) Hmm the setting is supposed to be stored automatically in a cookie, but I have problems to make this work in my FF.

      3) seems like I misinterpreted the mechanism, looks like another pure client-side JS solution for highlighting. My Idea was rather to use perltidy for adding highlight-<span>s on the server side, and to control the CSS settings via JS on the client side. Should be much faster, too.

        As for reasons why to use yet another parser, it might have something to do with wanting to parse code snippets, which may not even be complete valid Perl, and which are embedded in other text.

        Most of the parsers I know tend to assume what you feed to them is supposed to be valid code, and is all supposed to be code.

        Talking about automation, I couldn't find an option to save highlighting as default (e.g. in cookie).²

        It did save the highlighting for me; though I notice that /js/jquery-cookie.js is 404ing.

Re: Syntax highlighting for CPAN (Source)
by toolic (Bishop) on Mar 24, 2011 at 13:16 UTC
Re: Syntax highlighting for CPAN
by Fox (Pilgrim) on Mar 24, 2011 at 13:24 UTC
    This is great and I'm glad for the post, I'm would probably never find the option otherwise !
Re: Syntax highlighting for CPAN
by repellent (Priest) on Mar 25, 2011 at 01:35 UTC
    ++ peachpuff, baby! Oh yeah.

    Many thanks for this great feature :-)

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2017-05-30 08:25 GMT
Find Nodes?
    Voting Booth?