Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: provide indication on sys.inputs that pandoc is running #56

Closed
ntjess opened this issue Nov 23, 2024 · 3 comments
Closed

Comments

@ntjess
Copy link

ntjess commented Nov 23, 2024

Given the minimal support for context and other potential quirks of pandoc interpretation, it might be nice for docs to know whether pandoc is processing them and simplify their layout accordingly.

One way typst supports environment conditions is through sys.inputs.

So ideally, we could write the following code:

#let template = something-complex-using-context
#if sys.inputs.at("pandoc-version", default: "").match("2\.[0-9]+") != none {
  template = doc => doc
}

and it would handle this case (or other version-specific pandoc constraints).

This is unlikely to introduce breaking changes, and providing a version number instead of true/false allows more backwards compatibility if new features are implemented.

Use case: I use pandoc to create readme's of typst libraries that render their example code into outputs (here's an example). However, this gets difficult when pandoc can't correctly interpret the rendered example code. Ideally, I could tell pandoc within the document to ignore these blocks when running.

Packages could also use this to insert phrases like "this document only compiles on pandoc 3.4.x+." or to panic with more informative error messages.

@jgm
Copy link
Owner

jgm commented Nov 24, 2024

That's a nice idea. But since the typst interpreter is from the typst package, maybe it makes more sense to set sys.inputs.at("typst-hs version")? Indeed, the typst interpreter doesn't know the pandoc version.

@ntjess
Copy link
Author

ntjess commented Nov 27, 2024

typst-hs-version makes sense to me. Would there be any benefit to also including the pandoc version?

@jgm
Copy link
Owner

jgm commented Nov 28, 2024

I don't see how to include the pandoc version. The interpretation of typst code is done by typst-hs, and it doesn't know the pandoc version.

@jgm jgm closed this as completed in 9707b74 Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants