Tinymist Docs

Exporting Documents

You can export your documents to various formats using the exportexport feature.

Export from Query Result

Hello World Example (VSCode Tasks)

You can export the result of a query as text using the exportexport command.

Given a code:


                                
#println("Hello World!")

                                
#println("Hello World! Again...")

                                
#println("Hello World!")

                                
#println("Hello World! Again...")

                                
#println("Hello World!")

                                
#println("Hello World! Again...")

                                
#println("Hello World!")

                                
#println("Hello World! Again...")

LSP should export the result of the query as text with the following content:


                                
Hello World!

                                
Hello World! Again...

                                
Hello World!

                                
Hello World! Again...

                                
Hello World!

                                
Hello World! Again...

                                
Hello World!

                                
Hello World! Again...

This requires the following configuration in your tasks.jsontasks.json file:


                                
{

                                
  "version": "2.0.0",

                                
  "tasks": [

                                
    {

                                
      "label": "Query as Text",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": "query",

                                
        "query.format": "txt",

                                
        "query.outputExtension": "out",

                                
        "query.field": "value",

                                
        "query.selector": "<print-effect>",

                                
        "query.one": true

                                
      }

                                
    },

                                
  ]

                                
}

                                
{

                                
  "version": "2.0.0",

                                
  "tasks": [

                                
    {

                                
      "label": "Query as Text",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": "query",

                                
        "query.format": "txt",

                                
        "query.outputExtension": "out",

                                
        "query.field": "value",

                                
        "query.selector": "<print-effect>",

                                
        "query.one": true

                                
      }

                                
    },

                                
  ]

                                
}

                                
{

                                
  "version": "2.0.0",

                                
  "tasks": [

                                
    {

                                
      "label": "Query as Text",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": "query",

                                
        "query.format": "txt",

                                
        "query.outputExtension": "out",

                                
        "query.field": "value",

                                
        "query.selector": "<print-effect>",

                                
        "query.one": true

                                
      }

                                
    },

                                
  ]

                                
}

                                
{

                                
  "version": "2.0.0",

                                
  "tasks": [

                                
    {

                                
      "label": "Query as Text",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": "query",

                                
        "query.format": "txt",

                                
        "query.outputExtension": "out",

                                
        "query.field": "value",

                                
        "query.selector": "<print-effect>",

                                
        "query.one": true

                                
      }

                                
    },

                                
  ]

                                
}

See the Sample Workspace: print-state for more details.

IEEE Example (VSCode Tasks)

This workspace gives an example to create and prepare IEEE papers using Typst, which exports typst documents to LaTeX.


                                
{

                                
  "version": "2.0.0",

                                
  "tasks": [

                                
    {

                                
      "label": "Export to LaTeX (IEEE)",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": ["tex"],

                                
        // It is totally legal to use the processor in the current workspace,

                                
        // but we suggest make a local package and use the package spec instead.

                                
        // like: "package": "@local/ieee-tex:0.1.0"

                                
        "processor": "/ieee-tex.typ",

                                
        "assetsPath": "${workspaceFolder}/target"

                                
      }

                                
    },

                                
    // todo: not working

                                
    {

                                
      "label": "Export to Word (IEEE)",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": ["word"]

                                
      }

                                
    }

                                
  ]

                                
}

                                


                                
{

                                
  "version": "2.0.0",

                                
  "tasks": [

                                
    {

                                
      "label": "Export to LaTeX (IEEE)",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": ["tex"],

                                
        // It is totally legal to use the processor in the current workspace,

                                
        // but we suggest make a local package and use the package spec instead.

                                
        // like: "package": "@local/ieee-tex:0.1.0"

                                
        "processor": "/ieee-tex.typ",

                                
        "assetsPath": "${workspaceFolder}/target"

                                
      }

                                
    },

                                
    // todo: not working

                                
    {

                                
      "label": "Export to Word (IEEE)",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": ["word"]

                                
      }

                                
    }

                                
  ]

                                
}

                                


                                
{

                                
  "version": "2.0.0",

                                
  "tasks": [

                                
    {

                                
      "label": "Export to LaTeX (IEEE)",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": ["tex"],

                                
        // It is totally legal to use the processor in the current workspace,

                                
        // but we suggest make a local package and use the package spec instead.

                                
        // like: "package": "@local/ieee-tex:0.1.0"

                                
        "processor": "/ieee-tex.typ",

                                
        "assetsPath": "${workspaceFolder}/target"

                                
      }

                                
    },

                                
    // todo: not working

                                
    {

                                
      "label": "Export to Word (IEEE)",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": ["word"]

                                
      }

                                
    }

                                
  ]

                                
}

                                


                                
{

                                
  "version": "2.0.0",

                                
  "tasks": [

                                
    {

                                
      "label": "Export to LaTeX (IEEE)",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": ["tex"],

                                
        // It is totally legal to use the processor in the current workspace,

                                
        // but we suggest make a local package and use the package spec instead.

                                
        // like: "package": "@local/ieee-tex:0.1.0"

                                
        "processor": "/ieee-tex.typ",

                                
        "assetsPath": "${workspaceFolder}/target"

                                
      }

                                
    },

                                
    // todo: not working

                                
    {

                                
      "label": "Export to Word (IEEE)",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": ["word"]

                                
      }

                                
    }

                                
  ]

                                
}

                                

It uses export to export the document to LaTeX.

See the Sample Workspace: IEEE Paper for more details.

Pdfpc Example (VSCode Tasks)

A more practical example is exporting the result of a query as a pdfpc file. You can use the following configuration in your tasks.jsontasks.json file to export the result of a query as a pdfpc file, which is adapted by Touying Slides.


                                
{

                                
  "label": "Query as Pdfpc",

                                
  "type": "typst",

                                
  "command": "export",

                                
  "export": {

                                
    "format": "query",

                                
    "query.format": "json",

                                
    "query.outputExtension": "pdfpc",

                                
    "query.selector": "<pdfpc-file>",

                                
    "query.field": "value",

                                
    "query.one": true

                                
  }

                                
}

                                
{

                                
  "label": "Query as Pdfpc",

                                
  "type": "typst",

                                
  "command": "export",

                                
  "export": {

                                
    "format": "query",

                                
    "query.format": "json",

                                
    "query.outputExtension": "pdfpc",

                                
    "query.selector": "<pdfpc-file>",

                                
    "query.field": "value",

                                
    "query.one": true

                                
  }

                                
}

                                
{

                                
  "label": "Query as Pdfpc",

                                
  "type": "typst",

                                
  "command": "export",

                                
  "export": {

                                
    "format": "query",

                                
    "query.format": "json",

                                
    "query.outputExtension": "pdfpc",

                                
    "query.selector": "<pdfpc-file>",

                                
    "query.field": "value",

                                
    "query.one": true

                                
  }

                                
}

                                
{

                                
  "label": "Query as Pdfpc",

                                
  "type": "typst",

                                
  "command": "export",

                                
  "export": {

                                
    "format": "query",

                                
    "query.format": "json",

                                
    "query.outputExtension": "pdfpc",

                                
    "query.selector": "<pdfpc-file>",

                                
    "query.field": "value",

                                
    "query.one": true

                                
  }

                                
}

To simplify configuration,


                                
{

                                
  "label": "Query as Pdfpc",

                                
  "type": "typst",

                                
  "command": "export",

                                
  "export": {

                                
    "format": "pdfpc"

                                
  }

                                
}

                                
{

                                
  "label": "Query as Pdfpc",

                                
  "type": "typst",

                                
  "command": "export",

                                
  "export": {

                                
    "format": "pdfpc"

                                
  }

                                
}

                                
{

                                
  "label": "Query as Pdfpc",

                                
  "type": "typst",

                                
  "command": "export",

                                
  "export": {

                                
    "format": "pdfpc"

                                
  }

                                
}

                                
{

                                
  "label": "Query as Pdfpc",

                                
  "type": "typst",

                                
  "command": "export",

                                
  "export": {

                                
    "format": "pdfpc"

                                
  }

                                
}

VSCode: Task Configuration

You can configure tasks in your tasks.jsontasks.json file to "persist" the arguments for exporting documents.

Example:


                                
{

                                
  "version": "2.0.0",

                                
  "tasks": [

                                
    {

                                
      "label": "Export as Html",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": "html"

                                
      }

                                
    },

                                
    {

                                
      "label": "Export as Markdown",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": "markdown"

                                
      }

                                
    },

                                
    {

                                
      "label": "Export as Plain Text",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": "html"

                                
      }

                                
    },

                                
    {

                                
      "label": "Export as SVG",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": "svg",

                                
        "merged": true

                                
      }

                                
    },

                                
    {

                                
      "label": "Export as PNG",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": "png",

                                
        // Default fill is white, but you can set it to transparent.

                                
        "fill": "#00000000",

                                
        "merged": true

                                
      }

                                
    },

                                
    {

                                
      "label": "Query as Pdfpc",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": "pdfpc"

                                
      }

                                
    },

                                
    {

                                
      "label": "Export as PNG and SVG",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        // You can export multiple formats at once.

                                
        "format": ["png", "svg"],

                                
        // To make a visual effect, we set an obvious low resolution.

                                
        // For a nice result, you should set a higher resolution like 288.

                                
        "png.ppi": 24,

                                
        "merged": true,

                                
        // To make a visual effect, we set an obvious huge gap.

                                
        // For a nice result, you should set a smaller gap like 10pt.

                                
        "merged.gap": "100pt"

                                
      }

                                
    }

                                
  ]

                                
}

                                
{

                                
  "version": "2.0.0",

                                
  "tasks": [

                                
    {

                                
      "label": "Export as Html",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": "html"

                                
      }

                                
    },

                                
    {

                                
      "label": "Export as Markdown",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": "markdown"

                                
      }

                                
    },

                                
    {

                                
      "label": "Export as Plain Text",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": "html"

                                
      }

                                
    },

                                
    {

                                
      "label": "Export as SVG",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": "svg",

                                
        "merged": true

                                
      }

                                
    },

                                
    {

                                
      "label": "Export as PNG",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": "png",

                                
        // Default fill is white, but you can set it to transparent.

                                
        "fill": "#00000000",

                                
        "merged": true

                                
      }

                                
    },

                                
    {

                                
      "label": "Query as Pdfpc",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": "pdfpc"

                                
      }

                                
    },

                                
    {

                                
      "label": "Export as PNG and SVG",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        // You can export multiple formats at once.

                                
        "format": ["png", "svg"],

                                
        // To make a visual effect, we set an obvious low resolution.

                                
        // For a nice result, you should set a higher resolution like 288.

                                
        "png.ppi": 24,

                                
        "merged": true,

                                
        // To make a visual effect, we set an obvious huge gap.

                                
        // For a nice result, you should set a smaller gap like 10pt.

                                
        "merged.gap": "100pt"

                                
      }

                                
    }

                                
  ]

                                
}

                                
{

                                
  "version": "2.0.0",

                                
  "tasks": [

                                
    {

                                
      "label": "Export as Html",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": "html"

                                
      }

                                
    },

                                
    {

                                
      "label": "Export as Markdown",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": "markdown"

                                
      }

                                
    },

                                
    {

                                
      "label": "Export as Plain Text",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": "html"

                                
      }

                                
    },

                                
    {

                                
      "label": "Export as SVG",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": "svg",

                                
        "merged": true

                                
      }

                                
    },

                                
    {

                                
      "label": "Export as PNG",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": "png",

                                
        // Default fill is white, but you can set it to transparent.

                                
        "fill": "#00000000",

                                
        "merged": true

                                
      }

                                
    },

                                
    {

                                
      "label": "Query as Pdfpc",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": "pdfpc"

                                
      }

                                
    },

                                
    {

                                
      "label": "Export as PNG and SVG",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        // You can export multiple formats at once.

                                
        "format": ["png", "svg"],

                                
        // To make a visual effect, we set an obvious low resolution.

                                
        // For a nice result, you should set a higher resolution like 288.

                                
        "png.ppi": 24,

                                
        "merged": true,

                                
        // To make a visual effect, we set an obvious huge gap.

                                
        // For a nice result, you should set a smaller gap like 10pt.

                                
        "merged.gap": "100pt"

                                
      }

                                
    }

                                
  ]

                                
}

                                
{

                                
  "version": "2.0.0",

                                
  "tasks": [

                                
    {

                                
      "label": "Export as Html",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": "html"

                                
      }

                                
    },

                                
    {

                                
      "label": "Export as Markdown",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": "markdown"

                                
      }

                                
    },

                                
    {

                                
      "label": "Export as Plain Text",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": "html"

                                
      }

                                
    },

                                
    {

                                
      "label": "Export as SVG",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": "svg",

                                
        "merged": true

                                
      }

                                
    },

                                
    {

                                
      "label": "Export as PNG",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": "png",

                                
        // Default fill is white, but you can set it to transparent.

                                
        "fill": "#00000000",

                                
        "merged": true

                                
      }

                                
    },

                                
    {

                                
      "label": "Query as Pdfpc",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        "format": "pdfpc"

                                
      }

                                
    },

                                
    {

                                
      "label": "Export as PNG and SVG",

                                
      "type": "typst",

                                
      "command": "export",

                                
      "export": {

                                
        // You can export multiple formats at once.

                                
        "format": ["png", "svg"],

                                
        // To make a visual effect, we set an obvious low resolution.

                                
        // For a nice result, you should set a higher resolution like 288.

                                
        "png.ppi": 24,

                                
        "merged": true,

                                
        // To make a visual effect, we set an obvious huge gap.

                                
        // For a nice result, you should set a smaller gap like 10pt.

                                
        "merged.gap": "100pt"

                                
      }

                                
    }

                                
  ]

                                
}

todo: documenting export options.


                                
[

                                
  {

                                
    "type": "typst",

                                
    "required": [

                                
      "command"

                                
    ],

                                
    "properties": {

                                
      "command": {

                                
        "type": "string",

                                
        "default": "export",

                                
        "description": "The command to run.",

                                
        "enum": [

                                
          "export"

                                
        ],

                                
        "enumDescriptions": [

                                
          "Export the document to specific format."

                                
        ]

                                
      },

                                
      "export": {

                                
        "type": "object",

                                
        "description": "Arguments for `export` command.",

                                
        "properties": {

                                
          "format": {

                                
            "description": "The format(s) to export the document to.",

                                
            "oneOf": [

                                
              {

                                
                "type": "string",

                                
                "description": "The format to export the document to.",

                                
                "enum": [

                                
                  "pdf",

                                
                  "png",

                                
                  "svg",

                                
                  "html",

                                
                  "markdown",

                                
                  "tex",

                                
                  "text",

                                
                  "query",

                                
                  "pdfpc"

                                
                ],

                                
                "enumDescriptions": [

                                
                  "PDF",

                                
                  "PNG",

                                
                  "SVG",

                                
                  "HTML",

                                
                  "Markdown",

                                
                  "TeX",

                                
                  "Plain Text",

                                
                  "Query Result",

                                
                  "Pdfpc (From Query)"

                                
                ],

                                
                "default": "pdf"

                                
              },

                                
              {

                                
                "type": "array",

                                
                "description": "The formats to export the document to.",

                                
                "items": {

                                
                  "type": "string",

                                
                  "description": "The format to export the document to.",

                                
                  "enum": [

                                
                    "pdf",

                                
                    "png",

                                
                    "svg",

                                
                    "html",

                                
                    "markdown",

                                
                    "tex",

                                
                    "text",

                                
                    "query",

                                
                    "pdfpc"

                                
                  ],

                                
                  "enumDescriptions": [

                                
                    "PDF",

                                
                    "PNG",

                                
                    "SVG",

                                
                    "HTML",

                                
                    "Markdown",

                                
                    "TeX",

                                
                    "Plain Text",

                                
                    "Query Result",

                                
                    "Pdfpc (From Query)"

                                
                  ],

                                
                  "default": "pdf"

                                
                }

                                
              }

                                
            ]

                                
          },

                                
          "inputPath": {

                                
            "title": "Input path",

                                
            "description": "The path pattern to the entry file (main) for compilation, you can use `$focused`, `$root`, `$dir`, `$name` to do magic configuration, e.g. `$dir/$name` (default) and `$root/target/$dir/$name`. A special value `$focused` is used to point to the currently focused file in the editor.",

                                
            "type": "string",

                                
            "default": "$focused"

                                
          },

                                
          "metadata": {

                                
            "type": "boolean",

                                
            "description": "Whether to generate metadata containing export arguments."

                                
          },

                                
          "pdf.creationTimestamp": {

                                
            "type": [

                                
              "string"

                                
            ],

                                
            "description": "The unix timestamp of the PDF creation. If not specified, the current time is used."

                                
          },

                                
          "png.ppi": {

                                
            "type": "number",

                                
            "description": "The PPI (pixels per inch) to use for PNG export",

                                
            "default": 144

                                
          },

                                
          "fill": {

                                
            "type": "string",

                                
            "description": "The fill color. Affected formats: `png`",

                                
            "examples": [

                                
              "white",

                                
              "#ffffff",

                                
              "#00000000"

                                
            ]

                                
          },

                                
          "png.fill": {

                                
            "type": "string",

                                
            "description": "The fill color. Affected formats: `png`",

                                
            "examples": [

                                
              "white",

                                
              "#ffffff",

                                
              "#00000000"

                                
            ],

                                
            "default": "white"

                                
          },

                                
          "merged": {

                                
            "type": "boolean",

                                
            "description": "Merge the pages into a single image. Affected formats: `png`, `svg`"

                                
          },

                                
          "svg.merged": {

                                
            "type": "boolean",

                                
            "description": "Merge the pages into a single SVG. Affected formats: `svg`"

                                
          },

                                
          "png.merged": {

                                
            "type": "boolean",

                                
            "description": "Merge the pages into a single PNG. Affected formats: `png`"

                                
          },

                                
          "merged.gap": {

                                
            "type": "string",

                                
            "description": "The gap between the pages when merging **with absolute typst unit**. Affected formats: `png`, `svg`",

                                
            "default": "0pt"

                                
          },

                                
          "svg.merged.gap": {

                                
            "type": "string",

                                
            "description": "The gap between the pages when merging **with absolute typst unit**. Affected formats: `svg`",

                                
            "default": "0pt"

                                
          },

                                
          "png.merged.gap": {

                                
            "type": "string",

                                
            "description": "The gap between the pages when merging **with absolute typst unit**. Affected formats: `png`",

                                
            "default": "0pt"

                                
          },

                                
          "query.format": {

                                
            "type": "string",

                                
            "description": "The format of the query output. Defaults to `json`.",

                                
            "default": "json",

                                
            "enum": [

                                
              "json",

                                
              "yaml",

                                
              "txt"

                                
            ],

                                
            "enumDescriptions": [

                                
              "JSON",

                                
              "YAML",

                                
              "Plain Text if the result is a string, otherwise raises an error. You may specific the field to use for the query with `query.field` and assert that there is only one result with `query.one`."

                                
            ]

                                
          },

                                
          "query.outputExtension": {

                                
            "type": "string",

                                
            "description": "The extension of the query output. Inferring from `query.format` if not specified."

                                
          },

                                
          "query.strict": {

                                
            "type": "boolean",

                                
            "description": "Whether to strictly check the query format. Defaults to `true`."

                                
          },

                                
          "query.pretty": {

                                
            "type": "boolean",

                                
            "description": "Whether to pretty print the query output. Defaults to `true`."

                                
          },

                                
          "query.selector": {

                                
            "type": "string",

                                
            "description": "The selector to use for the query. Must specified if `format`."

                                
          },

                                
          "query.field": {

                                
            "type": "string",

                                
            "description": "The field to use for the query."

                                
          },

                                
          "query.one": {

                                
            "type": "boolean",

                                
            "description": "Whether to only return one result. Defaults to `false`."

                                
          },

                                
          "processor": {

                                
            "type": [

                                
              "string",

                                
              "null"

                                
            ],

                                
            "description": "The processor to use for the markdown or TeX export.",

                                
            "default": null

                                
          },

                                
          "tex.processor": {

                                
            "type": [

                                
              "string",

                                
              "null"

                                
            ],

                                
            "description": "The processor to use for the TeX export.",

                                
            "default": null

                                
          },

                                
          "markdown.processor": {

                                
            "type": [

                                
              "string",

                                
              "null"

                                
            ],

                                
            "description": "The processor to use for the markdown export.",

                                
            "default": null

                                
          },

                                
          "assetsPath": {

                                
            "type": [

                                
              "string",

                                
              "null"

                                
            ],

                                
            "description": "The path to output assets to use for the markdown or TeX export.",

                                
            "default": null

                                
          },

                                
          "tex.assetsPath": {

                                
            "type": "string",

                                
            "description": "The path to output assets to use for the TeX export.",

                                
            "default": "target"

                                
          },

                                
          "markdown.assetsPath": {

                                
            "type": [

                                
              "string",

                                
              "null"

                                
            ],

                                
            "description": "The path to output assets to use for the markdown export.",

                                
            "default": null

                                
          }

                                
        }

                                
      }

                                
    }

                                
  }

                                
]

                                
[

                                
  {

                                
    "type": "typst",

                                
    "required": [

                                
      "command"

                                
    ],

                                
    "properties": {

                                
      "command": {

                                
        "type": "string",

                                
        "default": "export",

                                
        "description": "The command to run.",

                                
        "enum": [

                                
          "export"

                                
        ],

                                
        "enumDescriptions": [

                                
          "Export the document to specific format."

                                
        ]

                                
      },

                                
      "export": {

                                
        "type": "object",

                                
        "description": "Arguments for `export` command.",

                                
        "properties": {

                                
          "format": {

                                
            "description": "The format(s) to export the document to.",

                                
            "oneOf": [

                                
              {

                                
                "type": "string",

                                
                "description": "The format to export the document to.",

                                
                "enum": [

                                
                  "pdf",

                                
                  "png",

                                
                  "svg",

                                
                  "html",

                                
                  "markdown",

                                
                  "tex",

                                
                  "text",

                                
                  "query",

                                
                  "pdfpc"

                                
                ],

                                
                "enumDescriptions": [

                                
                  "PDF",

                                
                  "PNG",

                                
                  "SVG",

                                
                  "HTML",

                                
                  "Markdown",

                                
                  "TeX",

                                
                  "Plain Text",

                                
                  "Query Result",

                                
                  "Pdfpc (From Query)"

                                
                ],

                                
                "default": "pdf"

                                
              },

                                
              {

                                
                "type": "array",

                                
                "description": "The formats to export the document to.",

                                
                "items": {

                                
                  "type": "string",

                                
                  "description": "The format to export the document to.",

                                
                  "enum": [

                                
                    "pdf",

                                
                    "png",

                                
                    "svg",

                                
                    "html",

                                
                    "markdown",

                                
                    "tex",

                                
                    "text",

                                
                    "query",

                                
                    "pdfpc"

                                
                  ],

                                
                  "enumDescriptions": [

                                
                    "PDF",

                                
                    "PNG",

                                
                    "SVG",

                                
                    "HTML",

                                
                    "Markdown",

                                
                    "TeX",

                                
                    "Plain Text",

                                
                    "Query Result",

                                
                    "Pdfpc (From Query)"

                                
                  ],

                                
                  "default": "pdf"

                                
                }

                                
              }

                                
            ]

                                
          },

                                
          "inputPath": {

                                
            "title": "Input path",

                                
            "description": "The path pattern to the entry file (main) for compilation, you can use `$focused`, `$root`, `$dir`, `$name` to do magic configuration, e.g. `$dir/$name` (default) and `$root/target/$dir/$name`. A special value `$focused` is used to point to the currently focused file in the editor.",

                                
            "type": "string",

                                
            "default": "$focused"

                                
          },

                                
          "metadata": {

                                
            "type": "boolean",

                                
            "description": "Whether to generate metadata containing export arguments."

                                
          },

                                
          "pdf.creationTimestamp": {

                                
            "type": [

                                
              "string"

                                
            ],

                                
            "description": "The unix timestamp of the PDF creation. If not specified, the current time is used."

                                
          },

                                
          "png.ppi": {

                                
            "type": "number",

                                
            "description": "The PPI (pixels per inch) to use for PNG export",

                                
            "default": 144

                                
          },

                                
          "fill": {

                                
            "type": "string",

                                
            "description": "The fill color. Affected formats: `png`",

                                
            "examples": [

                                
              "white",

                                
              "#ffffff",

                                
              "#00000000"

                                
            ]

                                
          },

                                
          "png.fill": {

                                
            "type": "string",

                                
            "description": "The fill color. Affected formats: `png`",

                                
            "examples": [

                                
              "white",

                                
              "#ffffff",

                                
              "#00000000"

                                
            ],

                                
            "default": "white"

                                
          },

                                
          "merged": {

                                
            "type": "boolean",

                                
            "description": "Merge the pages into a single image. Affected formats: `png`, `svg`"

                                
          },

                                
          "svg.merged": {

                                
            "type": "boolean",

                                
            "description": "Merge the pages into a single SVG. Affected formats: `svg`"

                                
          },

                                
          "png.merged": {

                                
            "type": "boolean",

                                
            "description": "Merge the pages into a single PNG. Affected formats: `png`"

                                
          },

                                
          "merged.gap": {

                                
            "type": "string",

                                
            "description": "The gap between the pages when merging **with absolute typst unit**. Affected formats: `png`, `svg`",

                                
            "default": "0pt"

                                
          },

                                
          "svg.merged.gap": {

                                
            "type": "string",

                                
            "description": "The gap between the pages when merging **with absolute typst unit**. Affected formats: `svg`",

                                
            "default": "0pt"

                                
          },

                                
          "png.merged.gap": {

                                
            "type": "string",

                                
            "description": "The gap between the pages when merging **with absolute typst unit**. Affected formats: `png`",

                                
            "default": "0pt"

                                
          },

                                
          "query.format": {

                                
            "type": "string",

                                
            "description": "The format of the query output. Defaults to `json`.",

                                
            "default": "json",

                                
            "enum": [

                                
              "json",

                                
              "yaml",

                                
              "txt"

                                
            ],

                                
            "enumDescriptions": [

                                
              "JSON",

                                
              "YAML",

                                
              "Plain Text if the result is a string, otherwise raises an error. You may specific the field to use for the query with `query.field` and assert that there is only one result with `query.one`."

                                
            ]

                                
          },

                                
          "query.outputExtension": {

                                
            "type": "string",

                                
            "description": "The extension of the query output. Inferring from `query.format` if not specified."

                                
          },

                                
          "query.strict": {

                                
            "type": "boolean",

                                
            "description": "Whether to strictly check the query format. Defaults to `true`."

                                
          },

                                
          "query.pretty": {

                                
            "type": "boolean",

                                
            "description": "Whether to pretty print the query output. Defaults to `true`."

                                
          },

                                
          "query.selector": {

                                
            "type": "string",

                                
            "description": "The selector to use for the query. Must specified if `format`."

                                
          },

                                
          "query.field": {

                                
            "type": "string",

                                
            "description": "The field to use for the query."

                                
          },

                                
          "query.one": {

                                
            "type": "boolean",

                                
            "description": "Whether to only return one result. Defaults to `false`."

                                
          },

                                
          "processor": {

                                
            "type": [

                                
              "string",

                                
              "null"

                                
            ],

                                
            "description": "The processor to use for the markdown or TeX export.",

                                
            "default": null

                                
          },

                                
          "tex.processor": {

                                
            "type": [

                                
              "string",

                                
              "null"

                                
            ],

                                
            "description": "The processor to use for the TeX export.",

                                
            "default": null

                                
          },

                                
          "markdown.processor": {

                                
            "type": [

                                
              "string",

                                
              "null"

                                
            ],

                                
            "description": "The processor to use for the markdown export.",

                                
            "default": null

                                
          },

                                
          "assetsPath": {

                                
            "type": [

                                
              "string",

                                
              "null"

                                
            ],

                                
            "description": "The path to output assets to use for the markdown or TeX export.",

                                
            "default": null

                                
          },

                                
          "tex.assetsPath": {

                                
            "type": "string",

                                
            "description": "The path to output assets to use for the TeX export.",

                                
            "default": "target"

                                
          },

                                
          "markdown.assetsPath": {

                                
            "type": [

                                
              "string",

                                
              "null"

                                
            ],

                                
            "description": "The path to output assets to use for the markdown export.",

                                
            "default": null

                                
          }

                                
        }

                                
      }

                                
    }

                                
  }

                                
]

                                
[

                                
  {

                                
    "type": "typst",

                                
    "required": [

                                
      "command"

                                
    ],

                                
    "properties": {

                                
      "command": {

                                
        "type": "string",

                                
        "default": "export",

                                
        "description": "The command to run.",

                                
        "enum": [

                                
          "export"

                                
        ],

                                
        "enumDescriptions": [

                                
          "Export the document to specific format."

                                
        ]

                                
      },

                                
      "export": {

                                
        "type": "object",

                                
        "description": "Arguments for `export` command.",

                                
        "properties": {

                                
          "format": {

                                
            "description": "The format(s) to export the document to.",

                                
            "oneOf": [

                                
              {

                                
                "type": "string",

                                
                "description": "The format to export the document to.",

                                
                "enum": [

                                
                  "pdf",

                                
                  "png",

                                
                  "svg",

                                
                  "html",

                                
                  "markdown",

                                
                  "tex",

                                
                  "text",

                                
                  "query",

                                
                  "pdfpc"

                                
                ],

                                
                "enumDescriptions": [

                                
                  "PDF",

                                
                  "PNG",

                                
                  "SVG",

                                
                  "HTML",

                                
                  "Markdown",

                                
                  "TeX",

                                
                  "Plain Text",

                                
                  "Query Result",

                                
                  "Pdfpc (From Query)"

                                
                ],

                                
                "default": "pdf"

                                
              },

                                
              {

                                
                "type": "array",

                                
                "description": "The formats to export the document to.",

                                
                "items": {

                                
                  "type": "string",

                                
                  "description": "The format to export the document to.",

                                
                  "enum": [

                                
                    "pdf",

                                
                    "png",

                                
                    "svg",

                                
                    "html",

                                
                    "markdown",

                                
                    "tex",

                                
                    "text",

                                
                    "query",

                                
                    "pdfpc"

                                
                  ],

                                
                  "enumDescriptions": [

                                
                    "PDF",

                                
                    "PNG",

                                
                    "SVG",

                                
                    "HTML",

                                
                    "Markdown",

                                
                    "TeX",

                                
                    "Plain Text",

                                
                    "Query Result",

                                
                    "Pdfpc (From Query)"

                                
                  ],

                                
                  "default": "pdf"

                                
                }

                                
              }

                                
            ]

                                
          },

                                
          "inputPath": {

                                
            "title": "Input path",

                                
            "description": "The path pattern to the entry file (main) for compilation, you can use `$focused`, `$root`, `$dir`, `$name` to do magic configuration, e.g. `$dir/$name` (default) and `$root/target/$dir/$name`. A special value `$focused` is used to point to the currently focused file in the editor.",

                                
            "type": "string",

                                
            "default": "$focused"

                                
          },

                                
          "metadata": {

                                
            "type": "boolean",

                                
            "description": "Whether to generate metadata containing export arguments."

                                
          },

                                
          "pdf.creationTimestamp": {

                                
            "type": [

                                
              "string"

                                
            ],

                                
            "description": "The unix timestamp of the PDF creation. If not specified, the current time is used."

                                
          },

                                
          "png.ppi": {

                                
            "type": "number",

                                
            "description": "The PPI (pixels per inch) to use for PNG export",

                                
            "default": 144

                                
          },

                                
          "fill": {

                                
            "type": "string",

                                
            "description": "The fill color. Affected formats: `png`",

                                
            "examples": [

                                
              "white",

                                
              "#ffffff",

                                
              "#00000000"

                                
            ]

                                
          },

                                
          "png.fill": {

                                
            "type": "string",

                                
            "description": "The fill color. Affected formats: `png`",

                                
            "examples": [

                                
              "white",

                                
              "#ffffff",

                                
              "#00000000"

                                
            ],

                                
            "default": "white"

                                
          },

                                
          "merged": {

                                
            "type": "boolean",

                                
            "description": "Merge the pages into a single image. Affected formats: `png`, `svg`"

                                
          },

                                
          "svg.merged": {

                                
            "type": "boolean",

                                
            "description": "Merge the pages into a single SVG. Affected formats: `svg`"

                                
          },

                                
          "png.merged": {

                                
            "type": "boolean",

                                
            "description": "Merge the pages into a single PNG. Affected formats: `png`"

                                
          },

                                
          "merged.gap": {

                                
            "type": "string",

                                
            "description": "The gap between the pages when merging **with absolute typst unit**. Affected formats: `png`, `svg`",

                                
            "default": "0pt"

                                
          },

                                
          "svg.merged.gap": {

                                
            "type": "string",

                                
            "description": "The gap between the pages when merging **with absolute typst unit**. Affected formats: `svg`",

                                
            "default": "0pt"

                                
          },

                                
          "png.merged.gap": {

                                
            "type": "string",

                                
            "description": "The gap between the pages when merging **with absolute typst unit**. Affected formats: `png`",

                                
            "default": "0pt"

                                
          },

                                
          "query.format": {

                                
            "type": "string",

                                
            "description": "The format of the query output. Defaults to `json`.",

                                
            "default": "json",

                                
            "enum": [

                                
              "json",

                                
              "yaml",

                                
              "txt"

                                
            ],

                                
            "enumDescriptions": [

                                
              "JSON",

                                
              "YAML",

                                
              "Plain Text if the result is a string, otherwise raises an error. You may specific the field to use for the query with `query.field` and assert that there is only one result with `query.one`."

                                
            ]

                                
          },

                                
          "query.outputExtension": {

                                
            "type": "string",

                                
            "description": "The extension of the query output. Inferring from `query.format` if not specified."

                                
          },

                                
          "query.strict": {

                                
            "type": "boolean",

                                
            "description": "Whether to strictly check the query format. Defaults to `true`."

                                
          },

                                
          "query.pretty": {

                                
            "type": "boolean",

                                
            "description": "Whether to pretty print the query output. Defaults to `true`."

                                
          },

                                
          "query.selector": {

                                
            "type": "string",

                                
            "description": "The selector to use for the query. Must specified if `format`."

                                
          },

                                
          "query.field": {

                                
            "type": "string",

                                
            "description": "The field to use for the query."

                                
          },

                                
          "query.one": {

                                
            "type": "boolean",

                                
            "description": "Whether to only return one result. Defaults to `false`."

                                
          },

                                
          "processor": {

                                
            "type": [

                                
              "string",

                                
              "null"

                                
            ],

                                
            "description": "The processor to use for the markdown or TeX export.",

                                
            "default": null

                                
          },

                                
          "tex.processor": {

                                
            "type": [

                                
              "string",

                                
              "null"

                                
            ],

                                
            "description": "The processor to use for the TeX export.",

                                
            "default": null

                                
          },

                                
          "markdown.processor": {

                                
            "type": [

                                
              "string",

                                
              "null"

                                
            ],

                                
            "description": "The processor to use for the markdown export.",

                                
            "default": null

                                
          },

                                
          "assetsPath": {

                                
            "type": [

                                
              "string",

                                
              "null"

                                
            ],

                                
            "description": "The path to output assets to use for the markdown or TeX export.",

                                
            "default": null

                                
          },

                                
          "tex.assetsPath": {

                                
            "type": "string",

                                
            "description": "The path to output assets to use for the TeX export.",

                                
            "default": "target"

                                
          },

                                
          "markdown.assetsPath": {

                                
            "type": [

                                
              "string",

                                
              "null"

                                
            ],

                                
            "description": "The path to output assets to use for the markdown export.",

                                
            "default": null

                                
          }

                                
        }

                                
      }

                                
    }

                                
  }

                                
]

                                
[

                                
  {

                                
    "type": "typst",

                                
    "required": [

                                
      "command"

                                
    ],

                                
    "properties": {

                                
      "command": {

                                
        "type": "string",

                                
        "default": "export",

                                
        "description": "The command to run.",

                                
        "enum": [

                                
          "export"

                                
        ],

                                
        "enumDescriptions": [

                                
          "Export the document to specific format."

                                
        ]

                                
      },

                                
      "export": {

                                
        "type": "object",

                                
        "description": "Arguments for `export` command.",

                                
        "properties": {

                                
          "format": {

                                
            "description": "The format(s) to export the document to.",

                                
            "oneOf": [

                                
              {

                                
                "type": "string",

                                
                "description": "The format to export the document to.",

                                
                "enum": [

                                
                  "pdf",

                                
                  "png",

                                
                  "svg",

                                
                  "html",

                                
                  "markdown",

                                
                  "tex",

                                
                  "text",

                                
                  "query",

                                
                  "pdfpc"

                                
                ],

                                
                "enumDescriptions": [

                                
                  "PDF",

                                
                  "PNG",

                                
                  "SVG",

                                
                  "HTML",

                                
                  "Markdown",

                                
                  "TeX",

                                
                  "Plain Text",

                                
                  "Query Result",

                                
                  "Pdfpc (From Query)"

                                
                ],

                                
                "default": "pdf"

                                
              },

                                
              {

                                
                "type": "array",

                                
                "description": "The formats to export the document to.",

                                
                "items": {

                                
                  "type": "string",

                                
                  "description": "The format to export the document to.",

                                
                  "enum": [

                                
                    "pdf",

                                
                    "png",

                                
                    "svg",

                                
                    "html",

                                
                    "markdown",

                                
                    "tex",

                                
                    "text",

                                
                    "query",

                                
                    "pdfpc"

                                
                  ],

                                
                  "enumDescriptions": [

                                
                    "PDF",

                                
                    "PNG",

                                
                    "SVG",

                                
                    "HTML",

                                
                    "Markdown",

                                
                    "TeX",

                                
                    "Plain Text",

                                
                    "Query Result",

                                
                    "Pdfpc (From Query)"

                                
                  ],

                                
                  "default": "pdf"

                                
                }

                                
              }

                                
            ]

                                
          },

                                
          "inputPath": {

                                
            "title": "Input path",

                                
            "description": "The path pattern to the entry file (main) for compilation, you can use `$focused`, `$root`, `$dir`, `$name` to do magic configuration, e.g. `$dir/$name` (default) and `$root/target/$dir/$name`. A special value `$focused` is used to point to the currently focused file in the editor.",

                                
            "type": "string",

                                
            "default": "$focused"

                                
          },

                                
          "metadata": {

                                
            "type": "boolean",

                                
            "description": "Whether to generate metadata containing export arguments."

                                
          },

                                
          "pdf.creationTimestamp": {

                                
            "type": [

                                
              "string"

                                
            ],

                                
            "description": "The unix timestamp of the PDF creation. If not specified, the current time is used."

                                
          },

                                
          "png.ppi": {

                                
            "type": "number",

                                
            "description": "The PPI (pixels per inch) to use for PNG export",

                                
            "default": 144

                                
          },

                                
          "fill": {

                                
            "type": "string",

                                
            "description": "The fill color. Affected formats: `png`",

                                
            "examples": [

                                
              "white",

                                
              "#ffffff",

                                
              "#00000000"

                                
            ]

                                
          },

                                
          "png.fill": {

                                
            "type": "string",

                                
            "description": "The fill color. Affected formats: `png`",

                                
            "examples": [

                                
              "white",

                                
              "#ffffff",

                                
              "#00000000"

                                
            ],

                                
            "default": "white"

                                
          },

                                
          "merged": {

                                
            "type": "boolean",

                                
            "description": "Merge the pages into a single image. Affected formats: `png`, `svg`"

                                
          },

                                
          "svg.merged": {

                                
            "type": "boolean",

                                
            "description": "Merge the pages into a single SVG. Affected formats: `svg`"

                                
          },

                                
          "png.merged": {

                                
            "type": "boolean",

                                
            "description": "Merge the pages into a single PNG. Affected formats: `png`"

                                
          },

                                
          "merged.gap": {

                                
            "type": "string",

                                
            "description": "The gap between the pages when merging **with absolute typst unit**. Affected formats: `png`, `svg`",

                                
            "default": "0pt"

                                
          },

                                
          "svg.merged.gap": {

                                
            "type": "string",

                                
            "description": "The gap between the pages when merging **with absolute typst unit**. Affected formats: `svg`",

                                
            "default": "0pt"

                                
          },

                                
          "png.merged.gap": {

                                
            "type": "string",

                                
            "description": "The gap between the pages when merging **with absolute typst unit**. Affected formats: `png`",

                                
            "default": "0pt"

                                
          },

                                
          "query.format": {

                                
            "type": "string",

                                
            "description": "The format of the query output. Defaults to `json`.",

                                
            "default": "json",

                                
            "enum": [

                                
              "json",

                                
              "yaml",

                                
              "txt"

                                
            ],

                                
            "enumDescriptions": [

                                
              "JSON",

                                
              "YAML",

                                
              "Plain Text if the result is a string, otherwise raises an error. You may specific the field to use for the query with `query.field` and assert that there is only one result with `query.one`."

                                
            ]

                                
          },

                                
          "query.outputExtension": {

                                
            "type": "string",

                                
            "description": "The extension of the query output. Inferring from `query.format` if not specified."

                                
          },

                                
          "query.strict": {

                                
            "type": "boolean",

                                
            "description": "Whether to strictly check the query format. Defaults to `true`."

                                
          },

                                
          "query.pretty": {

                                
            "type": "boolean",

                                
            "description": "Whether to pretty print the query output. Defaults to `true`."

                                
          },

                                
          "query.selector": {

                                
            "type": "string",

                                
            "description": "The selector to use for the query. Must specified if `format`."

                                
          },

                                
          "query.field": {

                                
            "type": "string",

                                
            "description": "The field to use for the query."

                                
          },

                                
          "query.one": {

                                
            "type": "boolean",

                                
            "description": "Whether to only return one result. Defaults to `false`."

                                
          },

                                
          "processor": {

                                
            "type": [

                                
              "string",

                                
              "null"

                                
            ],

                                
            "description": "The processor to use for the markdown or TeX export.",

                                
            "default": null

                                
          },

                                
          "tex.processor": {

                                
            "type": [

                                
              "string",

                                
              "null"

                                
            ],

                                
            "description": "The processor to use for the TeX export.",

                                
            "default": null

                                
          },

                                
          "markdown.processor": {

                                
            "type": [

                                
              "string",

                                
              "null"

                                
            ],

                                
            "description": "The processor to use for the markdown export.",

                                
            "default": null

                                
          },

                                
          "assetsPath": {

                                
            "type": [

                                
              "string",

                                
              "null"

                                
            ],

                                
            "description": "The path to output assets to use for the markdown or TeX export.",

                                
            "default": null

                                
          },

                                
          "tex.assetsPath": {

                                
            "type": "string",

                                
            "description": "The path to output assets to use for the TeX export.",

                                
            "default": "target"

                                
          },

                                
          "markdown.assetsPath": {

                                
            "type": [

                                
              "string",

                                
              "null"

                                
            ],

                                
            "description": "The path to output assets to use for the markdown export.",

                                
            "default": null

                                
          }

                                
        }

                                
      }

                                
    }

                                
  }

                                
]

After configuring the tasks, you can run them using the command palette.

  1. Press Ctrl+Shift+PCtrl+Shift+P to open the command palette.
  2. Type Run TaskRun Task and select the task you want to run.
  3. Select the task you want to run.

Neovim: Export Commands

You can call the following export commands.

  • tinymist.exportSvgtinymist.exportSvg
  • tinymist.exportPngtinymist.exportPng
  • tinymist.exportPdftinymist.exportPdf
  • tinymist.exportHtmltinymist.exportHtml
  • tinymist.exportMarkdowntinymist.exportMarkdown
  • tinymist.exportTeXtinymist.exportTeX
  • tinymist.exportTexttinymist.exportText
  • tinymist.exportQuerytinymist.exportQuery

The first argument is the path to the file you want to export and the second argument is an object containing additional options.