COMMUNITY

Piping to the browser


(Brian Tiffin) #1

A tidbit that may help with certain workflow iterations, and just in case you haven’t seen the trick.

Some (most?) browsers accept data urls, scheme is data: data can be base64 encoded.

Put this u+x chmod script in your path (as pipefox for instance) and then you can pipe HTML output from tools like pandoc, directly to the browser (usually a new tab pops up, depending on Preferences)

#!/bin/bash
firefox "data:text/html;base64,$(base64 -w 0 <&0)"

Usage:

prompt$ pandoc -f markdown -t html README.reference-links.md | pipefox

A personal tool; security concerns dictate you don’t want to be piping Joe Q. Public generated data pages through your browser, at least not without piping to a text editor for inspection first.

Have good, make smooth