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
  • 6 years ago

Installs

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

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.