This is an unfortunate consequence of how eval is used in typst.
When markdown is parsed with the pakage and contains images, the path to find the eval is evaluated relative to the package file, NOT the main file.
When this package is used locally, this might not create any problem as the two files cmarker.typ and main.typ may well be in the same folder.
But for using the package using the package manager, this makes the code fails as the images are searched relative to whichever folder the package is stored. This issue extends to the web app as well.
To circumvent this, you need to defer the eval step and evaluate the converted typst string in the main.typ file.
For example,
#import "@preview/cmarker:0.1.0":*
#let out = (render(show-source: true,read("simple.md")))
#eval(out.text,mode:"markup")
Will work for a simple markdown file that loads a single image but only calling the render function will not.
This is an unfortunate consequence of how
eval
is used in typst.When markdown is parsed with the pakage and contains images, the path to find the
eval
is evaluated relative to the package file, NOT the main file.When this package is used locally, this might not create any problem as the two files
cmarker.typ
andmain.typ
may well be in the same folder.But for using the package using the package manager, this makes the code fails as the images are searched relative to whichever folder the package is stored. This issue extends to the web app as well.
To circumvent this, you need to defer the eval step and evaluate the converted typst string in the
main.typ
file.For example,
Will work for a simple markdown file that loads a single image but only calling the
render
function will not.