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

Set compiler version using magic comments #544

Open
collide2954 opened this issue Feb 15, 2025 · 3 comments
Open

Set compiler version using magic comments #544

collide2954 opened this issue Feb 15, 2025 · 3 comments
Labels
feature request New feature or request.

Comments

@collide2954
Copy link

Description

A document-level version selector could be implemented using a specially formatted comment block placed within the first portion of the document. This approach provides immediate version identification without requiring manual configuration, and ensures ease of consistency.

/* typst-version: <version> */
/* typst-version: v1.0.0 */

Use Case

The magic comment feature enables writers to embed version requirements directly within their documents, eliminating the need to manually configure from the settings panel. This enhancement particularly benefits collaborative environments where multiple team members work with different versions of Typst across different documents, as the version requirement travels with the document rather than being stored separately in the preferences. By placing the version specification at the top of the file, developers can ensure consistent rendering.

@collide2954 collide2954 added the feature request New feature or request. label Feb 15, 2025
@adrienm7
Copy link

+1 for this feature request.

Typst allows specifying the version of imported packages, so it was surprising to see that the same isn't possible for the Typst compiler itself.

This feature would be particularly valuable, as breaking changes between compiler versions can impact project compatibility.

@wrzian
Copy link

wrzian commented Feb 16, 2025

This reminds me of frontmatter YAML metadata in Markdown documents, which I personally don't think would be good for Typst. I think this would be better served by the existing project metadata found in the typst.toml file used by packages, then somehow extended to web app.

@collide2954
Copy link
Author

This reminds me of frontmatter YAML metadata in Markdown documents, which I personally don't think would be good for Typst. I think this would be better served by the existing project metadata found in the typst.toml file used by packages, then somehow extended to web app.

That is also acceptable in my opinion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request.
Projects
None yet
Development

No branches or pull requests

3 participants