Syntax highlighting for search.cpan.org
If you're like me, you probably spend a lot of time looking at search.cpan.org. Occasionally I'll pull up perldoc
directly in the terminal, but I love reading docs in the browser.
I also love syntax highlighting. To some, it's superfluous. To others, it's downright confusing. But for those of us who use it all day every day, it's an essential tool that helps us read and understand code more quickly and with less effort.
It's always been a minor complaint that search.cpan.org does not put syntax highlighting on the perldocs.
Of course there are other sites that do, but I'll confess to using Google most often to look up Perl modules. And in the land of search results, search.cpan.org is king.
So without further ado, I'm happy to say that search.cpan.org has syntax highlighting. :) If you scroll to the bottom of any rendered document, you will find a dropdown menu to choose your color scheme. I recommend the "cpan" color scheme.
And if you hate syntax highlighting, don't get your panties in a bunch: "no syntax highlighting" is the default choice.
Many thanks to Graham Barr for his wonderful cooperation, accommodation, and help. And to the creators of SHJS and the other tools that make this possible.
Awesome!
Though...what we really need is syntax highlighting for the source.
I agree with tempire, but inline code in the POD is definitely nice to see syntax highlighting on.
F-in cool!
Btw, why is the dropdown at the very bottom? Aren't 99% of source code in POD in SYNOPSIS section (which is at the top)?
Also, while choice is good, perhaps make the interface simpler? There should be a link to [Turn on syntax highlighting], which will turn on syntax highlighting with the default scheme, and *then* after that show a link to [Change scheme].
And could we perhaps have our scheme setting persistent, via cookie or something. It's annoying to have to scroll to the bottom (and then scroll to the top again) for every POD every single time.
Just a couple of suggestion.
It is persistent. You set it once and forget it. :)
@Mark: Nice :)
Wonderful
That is really excellent. Well done to everyone involved.
Hoorah!
Very nice to see this.
LOVIN IT! Syntax highlighting is a tremendously effective productivity booster!
This is awesome, thank you!
But I would argue that syntax highlighting should be the default. Lots of casual Perl users and Perl curious people will see these docs and totally miss out. It shouldn't be a feature just for people in the know.
And if some old curmudgeons don't like they can always turn it off. But that seems like the exception rather than the rule.
I agree that it should be default, and initially had it that way.
But ultimately it was not my decision to make. So I'm just pushing for baby steps at the moment.
It is hard to make it the default since the part that is being highlighted is the "Verbatim Paragraph" which could really be anything. Some people put ASCII diagrams there, some put non-Perl code there, etc.
This really a huge improvement. Thanks very much for this! Let me add my vote for turning on highlighting by default. I realize it makes a few non-perl blocks look wacky, but I think the benefits far outweigh the disadvantages as far as readability goes in those few cases.
Having said that, even Acme::EyeDrops looks pretty cool with highlighting turned on.
I'd love to be able to support this in pod2cpanhtml.
Could you drop me a line at jmcnamara@cpan.org to lay out what work needs to be done around Pod::Simple to enable this.