Add async Lua execution, fetch_url, and blocking native support#107
Merged
Conversation
Make Lua filter/shortcode execution async to support yielding operations like network fetches. Implement fetch_url for both native (reqwest) and WASM (JS fetch shim) runtimes. Make AstTransform trait and the full shortcode resolution pipeline async to propagate async through the render pipeline. Add pcall+async test and mediabag fetch error logging.
The native render pipeline uses pollster::block_on which provides no tokio reactor. Switch NativeRuntime::fetch_url to reqwest::blocking::get so HTTP requests work without an async runtime. Fix quarto.base64.encode to accept binary (non-UTF-8) data. Add e2e smoke test exercising the full mediabag.fetch -> base64.encode -> data URI image pipeline.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fetch_urlfor both native (reqwest) and WASM (JS fetch shim) runtimes, withpandoc.mediabag.fetch(url)supportAstTransformtrait and the full shortcode resolution pipeline async to propagate async through the render pipelinereqwest::blockingfor nativefetch_urlsince the render pipeline usespollster::block_on(no tokio reactor)quarto.base64.encodeto accept binary (non-UTF-8) data from fetched imagesmediabag.fetch→base64.encode→ data URI image pipelineTest plan
mediabag.fetch, base64-encodes it, and embeds as a data URI{{< placeholder 200 format=png >}}renders embedded PNG via native CLI{{< image url >}}shortcode works in both native and quarto-hub (WASM)cargo nextest run --workspace— 7232 passed, 0 failed