#Conch — a shell simulator for Typst

1 messages · Page 1 of 1 (latest)

light pendant
#

Just built conch — a shell simulator for Typst: you write terminal-style sessions in .typ, it runs on a virtual FS (Rust WASM) and renders a terminal with colors / ANSI / animation. Three layers: frame only, ANSI only, or full shell (pipes, redirects, lots of unix-y commands).

Now supports keyboard events (left/right/home/end/backspace/ctrl-c) and is compatible with touying!

Now on Universe — https://typst.app/universe/package/conch
Source & demos: https://github.com/lucifer1004/conch
Feedback welcome, especially weird command edge cases.

Typst

Simulate a shell and render terminal sessions in documents.

GitHub

A shell simulator for Typst. Contribute to lucifer1004/conch development by creating an account on GitHub.

wintry crater
#

Very cool!

placid apex
#

11/10 name

light pendant
verbal copper
#

Now embed a linux vm in it, install typst and run the package there again

#

Literally typst inception

safe field
#

what's the point of this

light pendant
safe field
#

it's plastic around highlight syntax, isn't it?

light pendant
safe field
#

okay

safe field
#

Is it possible to get rid off the GUI and just get the raw output?

safe field
#

but yea looks pretty cool tbh

#

especially i didnt know typst would allow animations ?

light pendant
light pendant
radiant sphinx
#

This is amazing

light pendant
lean raptor
#

Looks very cool.

Is there a way I could add my own "commands"? I guess that should use callbacks to given Typst functions that could simulate the output of commands I need.

brisk knot
#

Consider adding a feature to generate RUNME.sh as attachment which I can download and bash RUNME.sh > RUNME.sh.out and your code reads RUNME.sh.out to ensure all "simulated" outputs truly reflect execution results on the current machine

light pendant
grand fern
light pendant
brisk knot
#

Taking inspiration from your work...

light pendant
grand fern
#

@light pendant How can I set terminal-frame user and sytem

#

I just want to render my listings

#

This but in the terminal tho

light pendant
#

user and system can be directly set initially, and the user can be changed within the script with su

grand fern
#

Just the looks

light pendant
#
#terminal-frame(title: "cargo build", theme: "dracula")[
  \$ cargo build --release \
  Compiling my-app v0.1.0 \
  Finished release target(s) in 3.2s
]
#

Then you are free to write your own

#

Color can be done with ANSI:

#terminal-frame(title: "test results", theme: "catppuccin")[
  #render-ansi(
    "\u{1b}[1;32mPASSED\u{1b}[0m test_new\n\u{1b}[1;31mFAILED\u{1b}[0m test_pipe",
    theme: "catppuccin",
  )
]
grand fern
#

That will take soo long

#

I have so many listings

#

Is there a way I can define the system and user and still have a way to render the listing

grand fern
light pendant
#

You can simply wrap your listing with a custom function that adds the prefix

#

And actually, for custom listing, the terminal-frame function is unable to know which lines should have the prompt.

grand fern
light pendant
grand fern
#

I will provide the entire terminal listing

#

I just want the commands to be highlighted

#

and my user and system

#

with other syntactic surgar if possible within the frame