File: htmlize.el.html
This package converts the buffer text and the associated decorations to HTML.
To use it, just switch to the buffer you want HTML-ized and type
M-x htmlize-buffer. You will be switched to a new buffer that
contains the resulting HTML code. You can edit and inspect this
buffer, or you can just save it with C-x C-w. M-x htmlize-file
will find a file, fontify it, and save the HTML version in
FILE.html, without any additional intervention. M-x
htmlize-many-files allows you to htmlize any number of files in
the same manner. M-x htmlize-many-files-dired does the same for
files marked in a dired buffer.
Htmlize supports three types of HTML output, selected by setting
htmlize-output-type: css, inline-css, and font. In css
mode, htmlize uses cascading style sheets to specify colors; it
generates classes that correspond to Emacs faces and uses <span
class=FACE>...</span> to color parts of text. In this mode, the
produced HTML is valid under the 4.01 strict DTD, as confirmed by
the W3C validator. inline-css is like css, except the CSS is
put directly in the STYLE attribute of the SPAN element, making it
possible to paste the generated HTML into existing HTML documents.
In font mode, htmlize uses <font color="...">...</font> to
colorize HTML, which is not standard-compliant, but works better in
older browsers. css mode is the default.
You can also use htmlize from your Emacs Lisp code. When called
non-interactively, htmlize-buffer and htmlize-region will
return the resulting HTML buffer, but will not change current
buffer or move the point. Htmlize will do its best to work on
non-windowing Emacs sessions but the result will be limited to
colors supported by the terminal.
The latest version is available at:
<https://github.com/emacsorphanage/htmlize>
Thanks go to the many people who have sent reports and contributed comments, suggestions, and fixes. They include Ron Gut, Bob Weiner, Toni Drabik, Peter Breton, Ville Skytta, Thomas Vogels, Juri Linkov, Maciek Pasternacki, and many others.
User quotes: "You sir, are a sick, sick, _sick_ person. :)"
-- Bill Perry, author of Emacs/W3
Defined variables (22)
htmlize-after-hook | Hook run after htmlizing a buffer. |
htmlize-before-hook | Hook run before htmlizing a buffer. |
htmlize-convert-nonascii-to-entities | Whether non-ASCII characters should be converted to HTML entities. |
htmlize-css-name-prefix | The prefix used for CSS names. |
htmlize-face-overrides | Overrides for face definitions. |
htmlize-file-hook | Hook run by ‘htmlize-file’ after htmlizing a file, but before saving it. |
htmlize-force-inline-images | Non-nil means generate all images inline using data URLs. |
htmlize-generate-hyperlinks | Non-nil means auto-generate the links from URLs and mail addresses in buffer. |
htmlize-head-tags | Additional tags to insert within HEAD of the generated document. |
htmlize-html-charset | The charset declared by the resulting HTML documents. |
htmlize-html-major-mode | The mode the newly created HTML buffer will be put in. |
htmlize-hyperlink-style | The CSS style used for hyperlinks when in CSS mode. |
htmlize-ignore-face-size | Whether face size should be ignored when generating HTML. |
htmlize-image-mime-type-alist | Alist mapping Emacs image types to Mime media types. |
htmlize-max-alt-text | Maximum size of text to use as ALT text in images. |
htmlize-output-type | Output type of generated HTML, one of ‘css’, ‘inline-css’, or ‘font’. |
htmlize-pre-style | When non-nil, ‘<pre>’ tags will be decorated with style |
htmlize-replace-form-feeds | Non-nil means replace form feeds in source code with HTML separators. |
htmlize-transform-image | Function called to modify the image descriptor. |
htmlize-untabify | Non-nil means untabify buffer contents during htmlization. |
htmlize-use-images | Whether htmlize generates ‘img’ for images attached to buffer contents. |
htmlize-use-rgb-txt | Whether ‘rgb.txt’ should be used to convert color names to RGB. |