Skip to content

Commit 3b4c9bc

Browse files
claude: touch up type and docs
1 parent 68f4666 commit 3b4c9bc

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

packages/quarto-types/README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,35 @@ This package is designed to be a standalone, lightweight type library for extern
5454

5555
- **`RenderOptions`**: The internal Quarto version includes a `services: RenderServices` field, which provides access to temp file context, extension context, and notebook context. This field has been omitted as it requires pulling in large portions of Quarto's internal type system. All other fields are included. See [src/command/render/types.ts](https://github.com/quarto-dev/quarto-cli/blob/main/src/command/render/types.ts#L29-L42) for the full type.
5656

57-
### Simplified to `Record<string, unknown>`
57+
### Simplified to `Record<string, unknown>` or index signatures
5858

5959
- **`Format.render`**: The full internal type is `FormatRender` with 100+ lines of specific rendering options including brand configuration and CSS handling. See [src/config/types.ts](https://github.com/quarto-dev/quarto-cli/blob/main/src/config/types.ts#L463-L525).
6060

6161
- **`Format.execute`**: The full internal type is `FormatExecute` with specific execution options. See [src/config/types.ts](https://github.com/quarto-dev/quarto-cli/blob/main/src/config/types.ts#L527-L561).
6262

63+
- **`Format.pandoc`**: The full internal type is `FormatPandoc` with 80+ lines of pandoc-specific options. Simplified to `{ to?: string; [key: string]: unknown }` preserving only the most commonly accessed `to` property. See [src/config/types.ts](https://github.com/quarto-dev/quarto-cli/blob/main/src/config/types.ts#L563-L646).
64+
6365
When accessing properties from these records, use type assertions as needed:
6466

6567
```typescript
6668
const figFormat = options.format.execute["fig-format"] as string | undefined;
6769
const keepHidden = options.format.render?.["keep-hidden"] as boolean | undefined;
70+
const writer = options.format.pandoc.to; // Type-safe access to 'to'
71+
const standalone = options.format.pandoc["standalone"] as boolean | undefined;
6872
```
6973

74+
### Omitted optional functions
75+
76+
The full internal `Format` interface includes several optional functions that are used internally by Quarto but are not needed by external engines:
77+
78+
- **`mergeAdditionalFormats`**: Internal format merging logic
79+
- **`resolveFormat`**: Format resolution and normalization
80+
- **`formatExtras`**: Compute format-specific extras (requires `RenderServices` and `ProjectContext`)
81+
- **`formatPreviewFile`**: Preview file name transformation
82+
- **`extensions`**: Format-specific extension configuration
83+
84+
These functions require deep integration with Quarto's internal systems and are not exposed to external engines. See [src/config/types.ts](https://github.com/quarto-dev/quarto-cli/blob/main/src/config/types.ts#L420-L456) for the full `Format` interface.
85+
7086
## License
7187

7288
MIT

packages/quarto-types/src/metadata-types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export interface Format {
4747
/**
4848
* Format rendering options
4949
*/
50-
render?: Record<string, unknown>;
50+
render: Record<string, unknown>;
5151

5252
/**
5353
* Format execution options

0 commit comments

Comments
 (0)