How to fix PDF-as-image errors in Typst with VSCode + Tinymist locally?

I’m using a local development build of typst-cli (installed via cargo, git hash 721a7b18) to write my PhD thesis. My workflow relies on VSCode with the Tinymist extension for real-time previews.

The issue: While the document compiles without errors, clicking “Preview” in VSCode fails with:

unknown image format typst [Ln 67, Col 3]

This happens when I try to include PDF files as images. The compilation itself works, but the preview breaks.

Question: How can I smoothly preview PDFs-as-images in VSCode while writing?

Thanks!

You have to use the latest version of Typst within Tinymist. AFAIK, it hasn’t been updated yet. Not sure how easy it is to do it by yourself, last time I tried it, I failed miserably.

You have to use latest version of Typst within Tinymist

Sorry, I do not understand this statement. I installed the latest development version of typst-cli already. The git hash I provide is from last Monday as we speak currently.

You could try the VSCode Tinymist extension Pre-Release Version. See GitHub - Myriad-Dreamin/tinymist: Tinymist [ˈtaɪni mɪst] is an integrated language service for Typst [taɪpst]. for more details.

Not sure what happens if Tinymist and Typst versions are not aligned as described below:

The release cycle is as follows:

  • If there is a typst version update, a new major or minor version will be released intermediately. This means tinymist will always align the minor version with typst.
  • If there is at least a bug or feature added this week, a new patch version will be released.

… but maybe you just found out ;)

3 Likes

Tinymist uses an embedded Typst compiler. Nightly builds are published regularly, the exact versioning is explained in Introduction - Tinymist Docs.
You can install a nightly version of Tinymist in VS Code by right-clicking the extension, switching to Pre-Release and installing a specific version.

4 Likes

@vmartel08

Thanks a lot it worked with switching to the pre-release version of tinymist. Now the PDF-as-images are shown satisfactorily.

2 Likes

@flokl
So are you suggesting that every tinymist release is linked to the updated git commit hash of typst-cli in a corresponding manner?

The nightly release will use both tinymist and typst at main branch.

Oh, neat! That wasn’t the case before, I think.

2 Likes

Very neat indeed. It was whispered on here some time ago during the summer.

1 Like

The GitHub Releases page contains information about the last Typst commit included in a Tinymist release.