PDA

View Full Version : [ubuntu] Syntax Highlighting Command?



ubuntuforums
June 6th, 2009, 03:16 AM
Hi,
I'm trying to find out what this command is. A friend told me that you can export your code from vim into a syntax highlighted html page. He said this can also be done from the terminal, but he doesn't remember how. He said it's something like: '2html /dir/code.php' and it will output that code in html with syntax highlighting.

Does anyone know how to do this? This would be very helpful for me. Thanks.

Volt9000
June 6th, 2009, 04:32 AM
Did a quick search and found code2html, sounds like what you're looking for.



sudo apt-get install code2html


It's a separate program, however.

ubuntuforums
June 6th, 2009, 04:54 AM
That looks interesting, I'll try it. Thank you.

ubuntuforums
June 6th, 2009, 05:22 AM
I tried it out, it's what I want, unfortunately it doesn't support as many languages as I want. One of the most important ones for me is PHP, it isn't supported.

ad_267
June 6th, 2009, 05:44 AM
The highlight and source-highlight packages look like they might be what you're after. I'm not sure which one would be best, but source-highlight specifically mentions PHP support. "apt-cache search" is a useful tool. (Or synaptic)

Alias1407
June 6th, 2009, 06:14 AM
You might also try...


cat <path to file> | ccze

andrew.46
June 6th, 2009, 07:01 AM
Hi ubuntuforums,


I'm trying to find out what this command is. A friend told me that you can export your code from vim into a syntax highlighted html page. He said this can also be done from the terminal, but he doesn't remember how. He said it's something like: '2html /dir/code.php' and it will output that code in html with syntax highlighting.

Perhaps the command you are after is:


:TOhtml

typed from within vim. I have not experimented too much with this but it seems to work well enough for basic files.

All the best,

Andrew