PDConSec / vsc-print

Completely local print support for VS Code with syntax-colouring and line numbering
Other
68 stars 27 forks source link

source

Print code. Print rendered Markdown. Local or remote. Windows, Mac or Linux.

This release

Print now has a persistent cache for diagrams embedded in Markdown. Diagrams are rendered once, until you change them.

We stopped using VS Code's rendering pipeline for Markdown because Microsoft continues to evolve it in ways that clash with the needs of printing. Because it's not a published API, there is no announcement of breaking changes and no consideration of third party needs. So last release we switched to our own. There are lots of extensions that extend Markdown rendering for the built-in pipeline, but many of them were broken already for Print so we forged ahead - and promptly heard cries of protest from Kroki users.

Kroki is server-based. Normally we won't do anything that can't work offline, but there were two compelling factors

So while there was a drop in functionality for 0.12.3, with this release you can use the following:

BlockDiag BPMN Bytefield SeqDiag ActDiag NwDiag
PacketDiag RackDiag C4 with PlantUML D2 DBML Ditaa
Erd Excalidraw GraphViz KaTeX Mermaid MHCHEM
Nomnoml Pikchr PlantUML SmilesDrawer Structurizr Svgbob
Symbolator Tikz UMLet Vega Vega-lite WaveDrom
WireViz

Cross-platform printing

Print-jobs are rendered as styled HTML and served from an embedded webserver. Your local web browser is launched to load the print-job and give you printing options like paper size, page orientation and margin size.

So if you have a local browser that can print, and VS Code can launch it, you can print.

Source code

source

Markdown

Use fenced blocks for LaTeX and Mermaid diagrams. You can position Mermaid diagrams by wrapping them in a div with the class left, right, centre or fill. Similar support for LaTeX will come in a later release.

Markdown-rendered

Classic user experience

The print and print preview icon are on the toolbar when there is an active editor. VS Code shows extension contributions according to the language of the active editor. No active editor means no icons (someone thought we should "fix" this).

toolbar

If you have a text selection that crosses at least one line-break you can right click and choose Print or Print preview from the context menu to send just the selection to the printer. In the absence of a multi-line selection the entire document is printed. You can control the position of Print and Print preview in this menu, or remove it altogether.

context-menu-editor

Or you can right-click on a file in the file explorer pane and choose Print or Print preview from the context menu.

Highly configurable

There are a number of settings. Most of them you just need to read the descriptions on the settings page, but we're old school and we wrote a manual. If things aren't going well, consider reading it. If you have first-use problems, the manual contains a troubleshooting guide.

Some things you can configure:

Planned changes