Enter-tainer / typst-preview

[DEPRECATED] Use tinymist instead
https://Enter-tainer.github.io/typst-preview/
MIT License
444 stars 21 forks source link
typst typst-preview vscode vscode-extension

Important Notice

The contents of this repository have been consolidated into tinymist. It is an all-in-one language server for typst.

We recommend all users migrate to tinymist for the following benefits:

This repository will no longer be updated in future. All development will move to tinymist. Thank you for your support and understanding!

If you have any questions, please open an issue in the new repository.

Typst Preview VSCode

Preview your Typst files in vscode instantly!

Install this extension from marketplace, open command palette (Ctrl+Shift+P), and type >Typst Preview:.

https://github.com/Enter-tainer/typst-preview/assets/25521218/7a151b3d-fe50-4440-8aab-2cc9a9abcf37

https://github.com/Enter-tainer/typst-preview/assets/25521218/600529ce-8f42-4c2f-a224-b6b73e6ad017

This repo contains:

Features

For comparison between alternative tools, please refer to Comparison with other tools.

Bug report

To achieve high performance instant preview, we use a different rendering backend from official typst. We are making our best effort to keep the rendering result consistent with official typst. We have set up comprehensive tests to ensure the consistency of the rendering result. But we cannot guarantee that the rendering result is the same in all cases. There can be unknown corner cases that we haven't covered.

Therefore, if you encounter any rendering issue, please report it to this repo other than official typst repo.

How it works?

The extension watches for file changes, and incrementally compile your document to svg files. Then we use a websocket to send the rendered svg to the client. The client calculates the diff between the new svg and the old one, and apply the diff to the old one. This is done by a VDOM based incremental rendering technique.

If you are interested in the details, please refer to Typst-Preview Architecture.

Use without VSCode

You can use the binary typst-preview as a standalone typst preview server. It can be used to preview your document in browser. For example: typst-preview ./assets/demo/main.typ --partial-rendering. This should be useful if you don't use VSCode but still want to experience the low latency preview.

Use with other editors

Acknowledgements

Related projects

Legal

This project is not affiliated with, created by, or endorsed by Typst the brand.