Blog Archives
Using Vim to generate HTML output of code
Posted by Sayak Sarkar
This is an interesting bit that I learnt about from an email in a mailing list by James Pryor.
To generate html output for code within a shell script you can use:
vim myscript.sh '+syntax on' '+ set nu' '+set background=light' +TOhtml '+w myscript.html' '+qall!'
If you don’t want numbers and need a dark background you can use:
vim myscript.sh '+syntax on' '+ set nonu' '+set background=dark' +TOhtml '+w myscript.html' '+qall!'
Share this:
- Click to share on Facebook (Opens in new window)
- Click to share on Twitter (Opens in new window)
- Click to email a link to a friend (Opens in new window)
- Click to share on LinkedIn (Opens in new window)
- Click to print (Opens in new window)
- Click to share on Reddit (Opens in new window)
- Click to share on Tumblr (Opens in new window)
- Click to share on Pinterest (Opens in new window)
Posted in How-to Guides, Technology, Vim
Tags: bash, coding, fedora, fedora 18, Fedora 19, Fedora 20, html, Linux, open source, Operating system, rhel, scripting, sh to html, Software package (installation), technology, text editor, Vim