Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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

by Massyn (Hermit)
on Jun 16, 2002 at 03:06 UTC ( [id://174891]=perlquestion: print w/replies, xml ) Need Help??

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://174891]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2025-06-12 17:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.