Generate images of terminal commands with their outputs using Node.js and Shiki.
For more background, check out Generating Images of Nushell Commands.
Make sure you have Git, Node.js and Nushell installed, and then run the following.
git clone [email protected]:vlovgr/nu-shiki.git
cd nu-shiki
npm install
use nu-shiki.nuYou can optionally modify render.js with your own customizations (e.g. the font to use).
Once setup, you can use nu-shiki to generate images (defaults to ~/Downloads/screenshot.png).
let command = "http get https://jsonplaceholder.typicode.com/posts | where userId == 1 | first 3 | select id title"
http get https://jsonplaceholder.typicode.com/posts
| where userId == 1
| first 3
| select id title
| nu-shiki --format $commandThere is also the option to use --eval to both show and run the provided command.
nu-shiki --format --eval $commandNote syntax highlighting and colors may not always render as expected with this option.
Using the --lang option, you can render images of code in all supported languages.
Use git pull to fetch latest changes and make sure to run npm install afterwards.