Skip to content

Commit e08c590

Browse files
fix: correct resolveFullMarkdownForFile and target() documentation
- target() receives pre-expanded markdown from Quarto; engine extensions don't need to call resolveFullMarkdownForFile themselves - clarify the real purpose of target(): establishing input vs source, extracting metadata, and engine-specific setup (e.g. Jupyter's transient .quarto_ipynb) - demote resolveFullMarkdownForFile to a brief mention in EngineProjectContext rather than the centrepiece of the section - remove footnote implying Julia/marimo don't support includes
1 parent 36d9c1f commit e08c590

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

posts/2026-03-04/index.qmd

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ interface ExecutionTarget {
140140

141141
Most engines do the same thing here — read the file as a `MappedString` and extract its YAML. `MappedString` is a string that carries source location mapping so that error messages can point back to the right line in the original file. Use `quarto.mappedString.fromFile()` to create one.
142142

143-
[`{{< include >}}` shortcodes]({{< meta quarto-root >}}/docs/authoring/includes.html) can appear inside code blocks to import code. Call `context.resolveFullMarkdownForFile()` here to expand them before `execute()` sees the document — see [`EngineProjectContext`](#engineprojectcontext). Both knitr and Jupyter do this.[^2]
143+
The `markdown` parameter is pre-expanded by Quarto before `target()` is called: all [`{{< include >}}` shortcodes]({{< meta quarto-root >}}/docs/authoring/includes.html) in code blocks have already been resolved. Use `markdown` directly (or fall back to `quarto.mappedString.fromFile(file)` if it is `undefined`).
144144

145-
[^2]: Currently, neither marimo nor the Julia engine calls `resolveFullMarkdownForFile`.
145+
The main work of `target()` is establishing the `input` file — which may differ from `source`. Jupyter creates a transient `.quarto_ipynb` notebook from a `.qmd` source and sets `input` to that path. For most engine extensions `source === input`. Any engine-specific setup data (such as the resolved kernelspec for Jupyter) can be stashed in the optional `data` field of `ExecutionTarget` for `execute()` to pick up later.
146146

147147
### `execute()`
148148

@@ -383,14 +383,7 @@ The remaining methods are optional.
383383

384384
This is a restricted view of Quarto's project context, passed to `launch()`. See [`@quarto/types`]({{< meta quarto-types >}}/src/project-context.ts) for the full interface.
385385

386-
We won't cover every field here — `dir`, `isSingleFile`, `config`, `getOutputDirectory()`, and `fileInformationCache` are mostly self-explanatory. But one method requires explanation.
387-
388-
`resolveFullMarkdownForFile(engine, file, markdown?, force?)`
389-
: `{{< include >}}` shortcodes can appear inside code blocks to import code. The engine needs these expanded before execution, otherwise it will try to execute the raw shortcode text. A Lua filter later in the Pandoc pipeline also handles includes (including ones emitted by code execution), but that runs after the engine. This method expands all `{{< include >}}` shortcodes in the source document before the engine sees it.
390-
391-
: It reads the file (using `engine.markdownForFile()` if provided), breaks it into cells, scans every cell for `{{< include >}}` shortcodes, and replaces each one with the content of the referenced file. The result is a `MappedString` with all includes expanded and source locations preserved. Results are cached in `fileInformationCache` unless `force` is true.
392-
393-
: See [`target()`](#target) for usage.
386+
The fields are mostly self-explanatory: `dir`, `isSingleFile`, `config`, `getOutputDirectory()`, `fileInformationCache`, and `resolveFullMarkdownForFile()`. The last one is Quarto's internal mechanism for expanding [`{{< include >}}`]({{< meta quarto-root >}}/docs/authoring/includes.html) shortcodes — it is called automatically before `target()`, so engine extensions don't normally need to call it.
394387

395388

396389

0 commit comments

Comments
 (0)