Skip to content

Commit

Permalink
Merge pull request #9035 from quarto-dev/feature/image-data-url-pdf
Browse files Browse the repository at this point in the history
capture data-uris in mediabag
  • Loading branch information
cscheid authored Mar 11, 2024
2 parents b72bd3d + 1f036c2 commit 3cc4f40
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion news/changelog-1.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ All changes included in 1.5:

- ([#8939](https://github.com/quarto-dev/quarto-cli/pull/8939)): `quarto inspect` now takes an additional optional parameter to specify the output file, and provides the graph of include dependencies for the inspection target.

## Other Fixes
## Other Fixes and Improvements

- ([#8119](https://github.com/quarto-dev/quarto-cli/issues/8119)): More intelligently detect when ejs templates are modified during development, improving quality of life during preview.
- ([#8177](https://github.com/quarto-dev/quarto-cli/issues/8177)): Use an explicit path to `sysctl` when detecting MacOS architecture. (author: @kevinushey)
Expand All @@ -121,5 +121,6 @@ All changes included in 1.5:
- ([#8937](https://github.com/quarto-dev/quarto-cli/issues/8937)): Fix unix launcher script to properly handle spaces in the path to the quarto executable.
- ([#8898](https://github.com/quarto-dev/quarto-cli/issues/8898)): `.deb` and `.tar.gz` bundle contents are now associated to root user and group instead of default user and group for CI build runners.
- Add support for `{{< lipsum >}}` shortcode, which is useful for emitting placeholder text. Specify a specific number of paragraphs (`{{< lipsum 3 >}}`).
- Resolve data URIs in Pandoc's mediabag when rendering documents.
- Increase v8's max heap size by default, to avoid out-of-memory errors when rendering large documents (also cf. https://github.com/denoland/deno/issues/18935).
- Upgrade Deno to 1.41.0
5 changes: 4 additions & 1 deletion src/resources/filters/quarto-post/pdf-images.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ function pdfImages()
-- See if the path points to an SVG in the media bag
-- (been generated by a filter, for example)
return mediabag.with_mediabag_contents(image.src, function (mime_type, tempPath)
print(mime_type, tempPath)
if mime_type == 'image/svg+xml' then
local convertedPath = call_rsvg_convert(tempPath)
if convertedPath == nil then
Expand All @@ -101,7 +102,9 @@ function pdfImages()
image.src = mediabag.resolved_url_cache[image.src]
return image
end
local relativePath = image.src:match("https?://[%w%$%-%_%.%+%!%*%'%(%)%:%%]+/(.+)")

local relativePath = image.src:match("https?://[%w%$%-%_%.%+%!%*%'%(%)%:%%]+/(.+)") or
image.src:match("data:image/.+;base64,(.+)")
if not (relativePath or param("has-resource-path", false)) then
return nil
end
Expand Down

0 comments on commit 3cc4f40

Please sign in to comment.