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
  • 1 year ago
  • 58 minutes ago
  • 6 years ago

Installs

  • Total 39K
  • Win 21K
  • OS X 14K
  • Linux 4K
Jan 23 Jan 22 Jan 21 Jan 20 Jan 19 Jan 18 Jan 17 Jan 16 Jan 15 Jan 14 Jan 13 Jan 12 Jan 11 Jan 10 Jan 9 Jan 8 Jan 7 Jan 6 Jan 5 Jan 4 Jan 3 Jan 2 Jan 1 Dec 31 Dec 30 Dec 29 Dec 28 Dec 27 Dec 26 Dec 25 Dec 24 Dec 23 Dec 22 Dec 21 Dec 20 Dec 19 Dec 18 Dec 17 Dec 16 Dec 15 Dec 14 Dec 13 Dec 12 Dec 11 Dec 10 Dec 9
Windows 9 22 5 7 17 24 25 28 15 10 14 21 20 22 26 16 6 9 13 17 22 17 6 4 3 9 16 13 15 6 4 7 13 15 15 31 24 9 5 19 23 25 31 31 11 9
OS X 5 9 5 2 14 7 13 16 8 6 7 16 7 12 13 6 6 3 11 15 8 8 4 5 5 4 9 4 4 1 3 5 8 12 9 11 14 8 5 16 14 23 15 11 3 12
Linux 2 3 3 2 2 3 2 4 2 1 2 2 3 3 2 5 4 2 2 4 3 4 2 2 3 1 2 1 0 3 0 4 3 4 4 7 4 0 1 4 2 2 5 4 4 7

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.