Article View: comp.editors
Article #3935Re: auto generate HTML from syntax-highlighted buffer?
From: Stewart Bryce
Date: Thu, 28 Mar 2002 11:36
Date: Thu, 28 Mar 2002 11:36
54 lines
3314 bytes
3314 bytes
I think you are looking for htmlize.el This is perfect for what I need - just use the function htmlize-buffer save the resulting html and away you go. Extracts from the header are below! Enjoy! S ----extract from htmlize.el---- ;; This package analyses the text properties of the buffer and ;; converts them, along with the text, to HTML. Mail to ;; <hniksic@xemacs.org> to discuss features and additions. All ;; suggestions are more than welcome. ;; The latest version should be available at: ;; ;; <URL:http://fly.srk.fer.hr/~hniksic/emacs/htmlize.el> ;; ;; You can find the sample htmlize output (run on an older version of ;; `htmlize.el') at: ;; ;; <URL:http://fly.srk.fer.hr/~hniksic/emacs/htmlize.html> Matt Garman <garman@raw-sewage.net> writes: > Today I was writing some rather verbose comments in a C++ class header > file. Both vim and emacs do a nice job of nicely formatting/indenting > my code as well as beautifully syntax highlighting (font locking if > you like that term :) my code. > > I thought it sure would be nice if my editor could (automatically) > write an HTML version of the file, complete with the syntax > highlighting colors. In theory, this doesn't sound like it would be > too hard---the text is already there, and the editor already knows how > it's coloring things (which implies that it knows how to parse the > language). It's just a matter of writing out the file padded with the > right html tags. > > I suppose that technically this is out of the realm of an editor's > function, so maybe it's not for vim---but it screams emacs! <grin> > > Anyway, I am aware that there are tools that do this to some extent > (javadoc and her cousins). But I haven't seen a tool that both > doesn't require specially formatted comments and looks as pretty as > vim and emacs' syntax highlighting. Perhaps I haven't looked hard > enough though. > > Any thoughts, comments, ideas, etc? > > Matt > > -- > Matt Garman, matt@raw-sewage.net > ``I ain't never seen no whiskey, the blues made my sloppy drunk!'' > -- Sleepy John Estes, ``Leaving Trunk''
Technical Details
Message-ID:
<ulmccgbzm.fsf@mathworks.co.uk>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.mathworks.com!news.mathworks.com!news.mathworks.co.uk!not-for-mailReferences:
<slrnaa55sr.n2u.garman@news-proxy.cso.uiuc.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103b8b,ca539ea9a21a3cf9 X-Google-Attributes: gid103b8b,public X-Google-Thread: 107393,ca539ea9a21a3cf9 X-Google-Attributes: gid107393,public X-Google-ArrivalTime: 2002-03-28 03:36:53 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.mathworks.com!news.mathworks.com!news.mathworks.co.uk!not-for-mail From: Stewart Bryce <sbryce@mathworks.co.uk> Newsgroups: comp.editors,gnu.emacs.help Subject: Re: auto generate HTML from syntax-highlighted buffer? Date: 28 Mar 2002 11:36:45 +0000 Organization: The MathWorks UK Lines: 54 Sender: sbryce@SBRYCE Message-ID: <ulmccgbzm.fsf@mathworks.co.uk> References: <slrnaa55sr.n2u.garman@news-proxy.cso.uiuc.edu> NNTP-Posting-Host: sbryce.mathworks.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sabina.mathworks.co.uk 1017315412 27859 192.168.72.11 (28 Mar 2002 11:36:52 GMT) X-Complaints-To: jwoollatt@mathworks.co.uk NNTP-Posting-Date: Thu, 28 Mar 2002 11:36:52 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1