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

Print to HTML

by grubernaut ALL

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

Details

  • 2016.08.25.22.52.06
    2013.01.23.02.06.30
  • github.​com
  • 9 years ago
  • 2 weeks ago
  • 13 years ago

Installs

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

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.