Prequery

Web resources

Downloads files from the web. If a file required by the document exists already, it is not re-downloaded by default. This preprocessor can be used in combination with the Prequery package's image()image() function.

Configuration & defaults


                                
[[tool.prequery.jobs]]

                                
name = "..."  # required

                                
kind = "web-resource"

                                


                                
# the query getting metadata from the document

                                
# see https://typst.app/docs/reference/introspection/query/#command-line-queries

                                
query.selector = "<web-resource>"

                                
query.field = "value"

                                
# query.one = false  # this can not be changed for web-resource jobs

                                


                                
# force re-downloading existing files

                                
overwrite = false

                                
# can be set to `true` or a file name to keep a file with all known resources

                                
index = false

                                
[[tool.prequery.jobs]]

                                
name = "..."  # required

                                
kind = "web-resource"

                                


                                
# the query getting metadata from the document

                                
# see https://typst.app/docs/reference/introspection/query/#command-line-queries

                                
query.selector = "<web-resource>"

                                
query.field = "value"

                                
# query.one = false  # this can not be changed for web-resource jobs

                                


                                
# force re-downloading existing files

                                
overwrite = false

                                
# can be set to `true` or a file name to keep a file with all known resources

                                
index = false

                                
[[tool.prequery.jobs]]

                                
name = "..."  # required

                                
kind = "web-resource"

                                


                                
# the query getting metadata from the document

                                
# see https://typst.app/docs/reference/introspection/query/#command-line-queries

                                
query.selector = "<web-resource>"

                                
query.field = "value"

                                
# query.one = false  # this can not be changed for web-resource jobs

                                


                                
# force re-downloading existing files

                                
overwrite = false

                                
# can be set to `true` or a file name to keep a file with all known resources

                                
index = false

                                
[[tool.prequery.jobs]]

                                
name = "..."  # required

                                
kind = "web-resource"

                                


                                
# the query getting metadata from the document

                                
# see https://typst.app/docs/reference/introspection/query/#command-line-queries

                                
query.selector = "<web-resource>"

                                
query.field = "value"

                                
# query.one = false  # this can not be changed for web-resource jobs

                                


                                
# force re-downloading existing files

                                
overwrite = false

                                
# can be set to `true` or a file name to keep a file with all known resources

                                
index = false

Index

The web-resourceweb-resource preprocessor can optionally keep an index file. This means it will know what local files come from resources and can do a better job keeping local files and resources specified in the document in sync. If index = trueindex = true is configured, the default index file name web-resource-index.tomlweb-resource-index.toml is used.

When using an index, web-resourceweb-resource keeps track of all file names and and URLs in the document. If a file is present, but the associated URL changes, the resource will be re-downloaded; this is different from the default behavior, where an existing file would never be re-downloaded (since the preprocessor also doesn't know what URL the file previously came from).