http://www.perlmonks.org?node_id=174891

Massyn has asked for the wisdom of the Perl Monks concerning the following question: (data formatting)

How can I convert Perl code into HTML with syntax highlighting?

Originally posted as a Categorized Question.

  • Comment on How can I convert Perl code into HTML with syntax highlighting?

Replies are listed 'Best First'.
Re: How can I convert Perl code into HTML with syntax highlighting?
by ChemBoy (Priest) on Jun 16, 2002 at 03:12 UTC

    Use Perltidy's HTML formatting options (-html etc.) As shown in the Perltidy manual, you can generate a whole page or a simple preformatted section, with embedded or linked style sheets, and set different colors for all manner of different constructs.

Re: How can I convert Perl code into HTML with syntax highlighting?
by yodabjorn (Monk) on Jun 16, 2002 at 08:17 UTC

    vim can do it.

    :runtime! syntax/2html.vim
    To view the help page:
    :help 2html
    Details are in the vim help under "convert-to-HTML".

Re: How do I convert perl code to HTML?
by FoxtrotUniform (Prior) on Jun 16, 2002 at 03:12 UTC
    You can use perltidy with the -html option.

    Originally posted as a Categorized Answer.

Re: How can I convert Perl code into HTML with syntax highlighting?
by epoptai (Curate) on Jun 17, 2002 at 04:06 UTC

    Code2HTML is a free Perl script that syntax highlights 15 different programming languages.

Re: How do I convert perl code to HTML?
by %mick (Friar) on Jun 16, 2002 at 03:33 UTC
    You can also let vim do it. The not-so-gory details are in the vim help file under "convert-to-HTML".

    Originally posted as a Categorized Answer.

Re: How do I convert perl code to HTML?
by Anonymous Monk on Jun 17, 2002 at 05:48 UTC
    Check in CPAN, I think that there is some module in the B or Devel namespace that outputs an XML version of your code after compiling it; you can then write a stylesheet to transform it into HTML and you would be sure that the parsing is proper because it has been done by perl itself.

    Originally posted as a Categorized Answer.

Re: How can I convert Perl code into HTML with syntax highlighting?
by choroba (Cardinal) on Aug 12, 2010 at 17:56 UTC
Re: How can I convert Perl code into HTML with syntax highlighting?
by jackquil36 (Initiate) on Feb 25, 2010 at 11:38 UTC
    thanks code2html works perfect!

    Originally posted as a Categorized Answer.

A reply falls below the community's threshold of quality. You may see it by logging in.
A reply falls below the community's threshold of quality. You may see it by logging in.