Thanks to visit codestin.com
Credit goes to github.com

Skip to content

vlovgr/nu-shiki

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🖼️ nu-shiki

Generate images of terminal commands with their outputs using Node.js and Shiki.

For more background, check out Generating Images of Nushell Commands.

Setup

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.nu

You can optionally modify render.js with your own customizations (e.g. the font to use).

Usage

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 $command
screenshot

There is also the option to use --eval to both show and run the provided command.

nu-shiki --format --eval $command

Note 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.

Updates

Use git pull to fetch latest changes and make sure to run npm install afterwards.

About

🖼️ Generate images of terminal commands

Topics

Resources

License

Stars

Watchers

Forks