Easily create formatted code snippets for presentations.
npm install --global presentable
Alternatively, prefix the below command with npx --yes
.
presentable \
--font 'JetBrains Mono' \
--style 'stackoverflow-light' \
path/to/snippets/*.js
would create an image (test-1.png
) like:
along with the HTML (test-1.html
) used to render the image.
As well as a positional list of files to process, the CLI accepts the following flags:
-
--background
/-b
: whether to include the background (default:true
) -
--font
/-f
: the name of a font on Google Fonts to use (default:undefined
, accept the UI's default) -
--output
/-o
: the directory to output to (default:"output/"
) -
--style
/-s
: the Highlight.js style to use (default:"default"
) - you can preview these here -
--width
/-w
: the target print width (default:50
, a reasonable fit for half a slide)
If a file contains folding regions, e.g.:
// ... imports and setup
//#region: snippet
console.log("this is my example");
//#endregion
the code from each region is extracted and saved into a separate file.