Here's a plugin for print preview in Sublime Test 3. (In addition to previewing, it can apply margins, fonts and other formatting to printed text, make use of a standard printer dialog box, or send text directly to a printer without preview or formatting.)
So far this is mostly a linux plugin - I haven't tested it under Windows yet. I am hoping first that someone will volunteer to test it further under linux and share feedback.
Depending on how you set up the configuration options, the plugin can perform a variety of formatting/viewing/printing tasks. Each of these tasks relies on an external program, as described below:
- Send unformatted text directly to the printer: Requires lpr.
- Display a standard dialog box for choosing a printer, duplex vs single sided, sheets per page, etc: Requires gtklp or xpp.
- Full page preview + printer dialog. Evince or okular. (Xpdf and acroread can also work for markdown files.)
- Applying formating to text documents and syntax highlighting to (printed) code: Needs enscript to create a temporary formatted postscript version of your document.
- Print/preview fully formatted markdown documents: Pandoc with latex, context or wkhtmltopdf. A temporary copy of the document is converted to pdf.
If you have selected one or more blocks of text when PreviewAndPrint is triggered, only the selected blocks of text will be previewed or printed. (You can change this behavior in the user configuration file.) If you have a working installation of pandoc and latex, you can preview (all of or selections from) latex formatted markdown files. Using the configuration file's "postscript options," you can set fonts, margins, etc for printed plain text documents.
A fuller explanation is in the readme file.
This plugin isn't in package control. Download the zipped files from here. Unzip into a directory under ~/.config/sublime-text-3/Packages/.
Feedback is much appreciated.