mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-08-04 18:28:02 +00:00
feat: support vscode tasks for exporting pdf, svg, and png (#488)
* feat: support vscode tasks for exporting pdf, svg, and png * fix: parse errors * dev: update fill, gap arguments * fix: merged props
This commit is contained in:
parent
60f3200088
commit
140299f0ce
11 changed files with 609 additions and 50 deletions
|
@ -14,6 +14,7 @@
|
|||
= Features
|
||||
- #chapter("feature/cli.typ")[Command line interface]
|
||||
- #chapter("feature/language.typ")[Language and Editor Features]
|
||||
- #chapter("feature/export.typ")[Exporting Documents]
|
||||
- #chapter("feature/preview.typ")[Document Preview]
|
||||
= Guide
|
||||
- #chapter("guide/completion.typ")[Completion]
|
||||
|
|
70
docs/tinymist/feature/export.typ
Normal file
70
docs/tinymist/feature/export.typ
Normal file
|
@ -0,0 +1,70 @@
|
|||
#import "mod.typ": *
|
||||
|
||||
#show: book-page.with(title: "Exporting Documents")
|
||||
|
||||
You can export your documents to various formats using the `export` feature.
|
||||
|
||||
== VSCode: Task Configuration
|
||||
|
||||
You can configure tasks in your `tasks.json` file to "persist" the arguments for exporting documents.
|
||||
|
||||
Example:
|
||||
|
||||
```json
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Export SVG",
|
||||
"type": "typst",
|
||||
"command": "export",
|
||||
"export": {
|
||||
"format": "svg",
|
||||
"merged": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Export PNG",
|
||||
"type": "typst",
|
||||
"command": "export",
|
||||
"export": {
|
||||
"format": "png",
|
||||
// Default fill is white, but you can set it to transparent.
|
||||
"fill": "#00000000",
|
||||
"merged": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Export PNG and SVG",
|
||||
"type": "typst",
|
||||
"command": "export",
|
||||
"export": {
|
||||
"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.
|
||||
|
||||
After configuring the tasks, you can run them using the command palette.
|
||||
+ Press `Ctrl+Shift+P` to open the command palette.
|
||||
+ Type `Run Task` and select the task you want to run.
|
||||
+ Select the task you want to run.
|
||||
|
||||
== Neovim: Export Commands
|
||||
|
||||
You can call the following export commands.
|
||||
- `tinymist.exportSvg`
|
||||
- `tinymist.exportPng`
|
||||
- `tinymist.exportPdf`
|
||||
|
||||
The first argument is the path to the file you want to export and the second argument is an object containing additional options.
|
Loading…
Add table
Add a link
Reference in a new issue