Typst and nushell

A few weeks back I cobbled together a first stab at a nushell extension called to-typst. So far all it does is convert nushell tabular output to a plain, unformatted Typst table. Next up should be nushell lists to tables, and I suppose a few options to apply a little basic formatting to column and row headings, or maybe even import a custom table definition from a file for fancier styling.

Questions:

  1. Would anyone here actually find this useful?
  2. What other functionality would you want?

I’m not a good programmer so don’t expect wonders, but I’ll try to incorporate suggestions.

3 Likes

This is great! Do you have a link for your extension?

  1. Yes!
  2. I’m relatively new to nushell so I don’t know if a nushell tabular behaves like a nushell DataFrame. In any case, it would be great if DataFrame’s are supported. Other than that, it could be great to have a little styling but I suppose this tool is mostly to generate something quicker from a csv file, for example? And then formatting in Typst?

I think a DataFrame is part of nu’s Polars functionality, so while similar to a table in some ways it’s not going to be exactly the same. A great idea to include them though.

Initially I got to work on it so I could convert some basic system stats from my PC into a nice PDF report for later reading. But yes, it could be used for a csv file, if you want to do some nushell manipulation on the data first rather than reading it directly into Typst.

Anyway, here’s a link. Don’t say I didn’t warn you about my programming ability :slight_smile:

2 Likes

Works like a charm. Thank you for sharing!

I think it is pretty usable right now as it is. Please do a showcase post when you want/can.

1 Like

Thanks, I’m delighted to hear it works! I’ll put up a showcase post by and by…

2 Likes

This seems to work (for now) from polars:

$my_dataframe_variable | polars into-nu | to typst

1 Like