ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Print to HTML

by grubernaut ST2/ST3

Sublime Text 3 plugin to print colorized files as HTML via your browser.

Details

  • 3 2016.08.25.22.52.06
    2 2013.01.23.02.06.30
  • github.​com
  • 2 years ago
  • 54 minutes ago
  • 6 years ago

Installs

  • Total 42K
  • Win 22K
  • OS X 15K
  • Linux 5K
Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12 Mar 11 Mar 10 Mar 9 Mar 8 Mar 7 Mar 6
Windows 30 23 35 42 22 10 5 19 16 43 27 26 14 14 24 24 18 26 18 9 8 11 24 19 21 23 16 10 8 30 20 27 16 6 13 19 18 23 24 20 7 10 25 31 23 37
OS X 8 12 11 14 11 8 3 4 18 13 16 15 9 11 8 8 18 6 12 3 8 9 8 9 19 7 4 5 7 13 11 17 13 4 6 13 20 20 18 11 12 7 7 14 17 22
Linux 2 4 2 6 9 3 2 5 7 3 7 9 2 1 14 5 8 5 5 2 1 2 4 4 3 4 5 1 5 5 3 4 5 1 1 7 4 1 4 5 3 3 8 6 6 4

Readme

Source
raw.​githubusercontent.​com

Sublime Text 3 Print to HTML

A Sublime Text 2/3 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.

Currently Plugin specified word wrap for ST3 is still under development. Web Browsers will still handle word wrap as necessary.

Installation

  • 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 https://github.com/jchampy/sublimetext-print-to-html "<Sublime Text 3 Packages folder>/Print to HTML"

Usage

  • 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

  • Re-Implement Word Wrap JavaScript once bugs are hashed out from SublimeText2 Version

  • 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).

Credits

The original code is available on Github. Pull requests are welcome.

Created by Joel Thornton.

Forked and updated to Python3 by Matt Hulse

Forked and Pushed for SublimeText3 by Jake Champlin

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