Tinymist (Typst) document preview in Kate

When I wrote LaTeX documents a lot, I really liked Kile for that job. I switched from LaTeX to Typst for nearly all of my typesetting needs and would love to have an experience similar to Kile when writing Typst documents.

Since Kate uses Tinymist as LSP for Typst files, the writing part is already straight forward. The only thing I’m missing is a live preview.

Tinymist can provide a preview, so I’m wondering if that could be integrated into Kate. The documentation for that feature is here: Preview Feature - Tinymist Docs

It basically works like this:

  • start the preview server with tinymist preview --invert-colors=never main.typ
  • access the preview under http://127.0.0.1:23625/

The preview would have to be generated from the editor buffer to see the updated preview while typing (that’s how it works with the Tinymist VSCode extension).

I guess this would be an addition to the already existing Document Preview Plugin, but I’m not sure how much work that would be.

1 Like

@sepp

What editor are you currently using for authoring Typst documents?

Or are you using Kate without a live preview?

I found Katvan on Flathub to work very well. It is also Qt-based.

2 Likes

I was using vscode-oss (from Arch repositories) for editing Typst files so far. The Tinymist extension is really great.

But Microsoft is forcing their copilot AI crap upon VSCode users in the UI everywhere and it’s becoming really tedious to disable it. So I decided to remove VSCode completely.

I’m currently using neovim with this plugin: GitHub - chomosuke/typst-preview.nvim: Low latency typst preview for Neovim
This works fine, but on every first start I have to do a few manual steps for an optimal setup (move the preview tab to a separate Firefox window, collapse the Firefox sidebar, tile neovim and preview window to be side by side), so I’d prefer a typst editor with an integrated preview.

Katvan looks really nice, thanks for the tip! I’ll try that.

1 Like

This should be simple to do and will have to be done outside kate in a separate KPart. You can just use QWebEngineView to open the Url. See for e.g., Milian Wolff / PlantUML KPart · GitLab a preview part for plant uml

1 Like

Thanks for the example! That looks doable, maybe I’ll attempt to implement a KPart for Typst.

1 Like