Lynchpin: WIP terminal export for typst

I somehow came up with the idea of rendering math and all other things of typst into a terminal. After weeks of copying and modifying typst-layout,here is what I’ve achieved so far:

Math

This is taken from the demo of the physica package. My layout style of math in the terminal took inspiration from Diagon. While the visual style is inspired by Diagon’s ASCII art, I have adapted most of the code from typst-layout’s paged export to work within the terminal’s constraints.

Fibonacci

underover

 1 + 2 + … + 5
 ─────────────

 0 + 1 + ⋯ +n
 ╰─────🮦────╯
 n + 1 numbers

 n + 1 numbers
 ╭─────🮧────╮
 0 + 1 + ⋯ +n

 0 + 1 + ⋯ +n
 └──────────┘
 n + 1 numbers

 n + 1 numbers
 ┌──────────┐
 0 + 1 + ⋯ +n

 0 + 1 + ⋯ +n
 ╰──────────╯
 n + 1 numbers

 0 + 1 + ⋯ +n
 🮡──────────🮠
 n + 1 numbers

(this one is not image as I can only put 2 embedded medias in a post.)

It can also handle cases, grid, query, reference, text style and more.

Though, not all the features of typst are supported and I need to polish it for while, so I’m not going to release it today. But I will surely make it open-source when I’m happy with it.

9 Likes

This is fascinating. Personally I prefer to work in the terminal, in part because of performance, in part because its a simpler workflow, in part because without a graphical desktop, only the terminal matters, and in part from personal preference.

I look forward to reading more about the progress of this effort.

2 Likes

Very cool. This could be one way to address Plaintext export · Issue #2401 · typst/typst · GitHub

2 Likes

Wow, thanks for the info! I didn’t know there was an open issue for this in the repository. This could definitely be a viable way to achieve text export.

This is awesome, impressive work! I’ve been trying to implement plaintext-compilation the past couple of days, but wow is it complicated, so hats off to you! I would love to try and contribute once you publish the repo :)