jgm/typst-hs

Pandoc looks for Typst packages with an incorrect path

Closed this issue · 2 comments

When running Pandoc on a Typst file, it looks for packages in ~/.cache/typst/packages/preview/packagename-major.minor.patch. However, the correct path is ~/.cache/typst/packages/preview/packagename/major.minor.patch (note that the version is a subdirectory, not separated with a hyphen).

For instance:

theo@dev ~/P/typst-test> cat main.typ
#import "@preview/tablex:0.0.6": tablex, cellx, colspanx, rowspanx

theo@dev ~/P/typst-test> typst compile main.typ main.pdf

theo@dev ~/P/typst-test> ls ~/.cache/typst/packages/preview
tablex/

theo@dev ~/P/typst-test> ls ~/.cache/typst/packages/preview/tablex/
0.0.6/

theo@dev ~/P/typst-test> pandoc --from typst --to docx -o main.docx ./main.typ
"./main.typ" (line 1, column 2):
Could not find package in local packages or cache. Looked in
/home/theo/.local/share/typst/packages/preview/tablex-0.0.6
/home/theo/.cache/typst/packages/preview/tablex-0.0.6
Compile with typst compile to bring the package into your local cache.

theo@dev ~/P/typst-test> pandoc --version
pandoc 3.1.9
Features: +server +lua
Scripting engine: Lua 5.4
User data directory: /home/theo/.local/share/pandoc
Copyright (C) 2006-2023 John MacFarlane. Web: https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.

theo@dev ~/P/typst-test> typst --version
typst 0.9.0 (7bb4f6df)

theo@dev ~/P/typst-test> uname -a
Linux dev.theo-lpt 6.5.11-300.fc39.x86_64 jgm/pandoc#1 SMP PREEMPT_DYNAMIC Wed Nov  8 22:37:57 UTC 2023 x86_64 GNU/Linux

theo@dev ~/P/typst-test> cat /etc/os-release 
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
VERSION_ID=20231105.0.189722
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://bugs.archlinux.org/"
PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/"
LOGO=archlinux-logo
jgm commented

That's odd, because I (think I) tested this. Did this path change in recent typst versions?

@jgm Just wanna say thank you for the quick fix! Much appreciated <3