Mark.Hedges has asked for the wisdom of the Perl Monks concerning the following question:

Is it possible?
  • Comment on perldoc terminal syntax color highlighting

Replies are listed 'Best First'.
Re: perldoc terminal syntax color highlighting
by Anonymous Monk on Aug 03, 2014 at 21:07 UTC
Re: perldoc terminal syntax color highlighting
by Anonymous Monk on Aug 03, 2014 at 23:07 UTC
     [cpan://pod term], [metacpan://pod term] pod term, pod term -> Pod::Perldoc::ToTerm - render Pod with terminal escapes ... alt, indent, loose, quotes, sentence, width

    So there you go, you have a start :) SMOP-it extension for code paragraphs (verbatim) with Text::VimColor and you're done

    You could also hack PPI::HTML to ansi up the text with Term::ANSIColor::Markup

    proof of concept should take all of 5 minutes ;P

Re: perldoc terminal syntax color highlighting
by zentara (Cardinal) on Aug 03, 2014 at 22:24 UTC
Re: perldoc terminal syntax color highlighting
by LanX (Saint) on Aug 03, 2014 at 22:03 UTC
    > Is it possible?

    Yes! But I haven't seen it implemented yet.

    Cheers Rolf

    (addicted to the Perl Programming Language and ☆☆☆☆ :)

    update

    Actually I'm not sure if there are native pagers which support coloring (like with Term::ANSIColor ), but you asked about terminals.

    Otherwise see How (Not) To Ask A Question.

Re: perldoc terminal syntax color highlighting ( perldocolor )
by Anonymous Monk on Aug 04, 2014 at 07:30 UTC

    And the concept is proven

    All thats left to do, is settle on a name (maybe call it perldocolor), maybe package it up as a module or a exe, improve color mapping naturally (allow for background and foreground... just finish it up, fill in the blanks, provide for stylesheet-alike specification, default stylesheets , work out the quirks with colorize)...

    You're welcome

      Too lazy for a proof of concept, but FWIW...

      ... I'd rather use perldoc -ohtml in combination with perltidy -html for the parts within <pre> tags and w3m or lynx as a "pager".

      NB: Not every intended block in POD is necessarily Perl code, so some "looks like Perl" heuristic might be useful.

      Cheers Rolf

      (addicted to the Perl Programming Language and ☆☆☆☆ :)

Re: perldoc terminal syntax color highlighting
by jimav (Sexton) on Mar 11, 2023 at 00:55 UTC
    Yes it is possible now. Using bash:

    export PERLDOC="-M Pod::Text::Color"
    or
    export PERLDOC="-M Pod::Text::Color::Delight"

    and now "perldoc" colorizes. Whichever module you use must be installed with, e.g. cpanm