Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Sublime Text 2 plugin to print colorized files as HTML via your browser.
branch: master
Failed to load latest commit information.
desktop Fixed error with reading XDG_CURRENT_DESKTOP key when it doesn't exist.
pygments And adding the import of all the other styles, so they work properly
.gitignore Ignore package-metadata.json.
Default (Linux).sublime-keymap
Default (OSX).sublime-keymap Changed OSX keybind back to Shift+Alt+P after finding most other ...+…
Default (Windows).sublime-keymap
Default.sublime-commands Refine menu/command names to be more accurate.
Main.sublime-menu Added settings for auto_print, auto_close, and monochrome
Print to HTML.sublime-settings Rename word_wrap_break_words to word_wrap_break_anywhere and improve … Rename word_wrap_break_words to word_wrap_break_anywhere and improve … And, allow different colour schemes to be used
wordwrap.js Improve comments.

Sublime Text 2 Print to HTML

A Sublime Text 2 plugin to print files as HTML with color syntax highlighting and line numbers, and open them in your browser for printing.

Colorization and HTML conversion is currently performed by Pygments, which supports a range of languages and syntaxes.


  • Install Package Manager.
  • Use Cmd+Shift+P or Ctrl+Shift+P then Package Control: Install Package.
  • Look for Print to HTML and install it.

If you prefer to install manually, install git, then:

git clone "<Sublime Text 2 Packages folder>/Print to HTML"


  • For best results, save your file with an appropriate extension beforehand.
  • To print the current file, use one of the following methods:
    • use Shift+Alt+P to print current file as HTML via your browser, or
    • from File menu, use Print as HTML to Browser or Print as HTML to New Buffer.
    • press Ctrl+Shift+P or Cmd+Shift+P then type print.
  • Edit settings in Preferences->Package Settings->Print in HTML to customize output formatting and behavior. Options such as monochrome, line numbering, and browser behavior can be modified.

Future goals

  • Use ST2's internal scope and color data from a buffer to produce an exact replica of a file from ST2 in HTML form. The current approach using Pygments has limitations regarding formats unknown by Pygments (e.g. Markdown) and documents with mixed syntaxes (e.g. PHP embedded in HTML).


This code is available on Github. Pull requests are welcome.

Created by Joel Thornton.

Uses the Pygments library (included) for code-to-HTML conversion.

Something went wrong with that request. Please try again.