Tool to add code highlighting and export to HTML
6 answers
Emacs supports exporting code to html using http://fly.srk.fer.hr/~hniksic/emacs/htmlize.el.cgi
+2
source to share
To be editor independent you can just use the ruby syntax gem. Here is an excerpt from the user manual showing the function you are looking for:
require 'syntax/convertors/html'
convertor = Syntax::Convertors::HTML.for_syntax "ruby"
html = convertor.convert( File.read( "program.rb" ) )
puts html
+1
source to share