Skip to content

Simultaneous query & compile #3015

Open

Description

@ntjess

Description

I have a large document that I would like to compile and see the results of some labeled content. Currently, I query and compile separately for 2 total calls to typst. It would be ideal to allow querying during compilation and print the query result to stdout while exporting files as usual.

Use Case

Any documents where both metadata and outputs are equally desirable. A common use case is slideshows. In one compilation, the svg slides can be generated and their metadata for transitions, speaker notes, etc. will also be available.

Activity

  1. added
    feature request
    on Dec 20, 2023
  2. added
    cli
    on Dec 21, 2023
  3. ensko commented on Jun 1, 2024

    @ensko
    SponsorContributor

    I think there are many generalizations that are worth considering from the start:

    • compile and do one query (the initial feature request)
    • (compile and) do multiple queries
    • do multiple compilations, e.g. with different --inputs or output formats
    • do any of these, even with different input documents (presumably, the input documents would be similar enough that a lot of memoized information would be reused between them)

    I think the last one may be attainable, but may also have the fewest legitimate use cases and/or it might be an anti-pattern to structure one's workflow in a way where this saves a lot of work.

    There has been some discussion on Discord in this direction: https://discord.com/channels/1054443721975922748/1245821833308012614

    One of the suggestions was the option to start Typst as a agent and access it using an ID:

    id=$(typst agent diagrams.typ)
    typst query --id "$id" --field value metadata
    typst c --id "$id"
    typst c --id "$id" 'diagram{n}.svg'
    typst agent --kill "$id"

    this would allow the first three scenarios in a natural way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    clifeature request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions