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
  • 1 hour ago
  • 7 years ago

Installs

  • Total 46K
  • Win 25K
  • OS X 16K
  • Linux 5K
Oct 21 Oct 20 Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7 Oct 6 Oct 5 Oct 4 Oct 3 Oct 2 Oct 1 Sep 30 Sep 29 Sep 28 Sep 27 Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18 Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10 Sep 9 Sep 8 Sep 7 Sep 6
Windows 8 14 25 29 25 40 34 11 13 19 33 28 22 23 6 7 22 27 27 29 16 9 14 11 17 25 20 21 19 8 17 33 21 26 23 10 7 20 24 20 17 22 7 8 16 27
OS X 2 7 9 15 16 15 11 4 5 9 17 18 19 15 6 9 11 12 11 13 10 9 4 13 21 7 8 14 9 6 10 5 10 14 13 3 5 9 10 5 11 10 5 6 11 11
Linux 2 3 4 8 5 1 4 3 4 4 5 7 8 7 4 3 3 4 4 3 5 2 2 1 4 6 2 2 1 3 1 6 2 5 2 3 4 0 6 4 8 5 0 3 3 3

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.