fix(filters): fix include-dark with meta-resolved image paths#2086
Open
mcanouil wants to merge 1 commit into
Open
fix(filters): fix include-dark with meta-resolved image paths#2086mcanouil wants to merge 1 commit into
mcanouil wants to merge 1 commit into
Conversation
Quarto adds a spurious extension when an image src is resolved via
{{< meta >}}, turning foo.png into foo.png.png. The include-dark.lua
filter then produced foo.png-dark.png (dark) and foo.png.png (light),
neither of which exists on disk.
Detect the double-extension case by checking whether the stem returned
by split_extension itself carries the same extension (e.g. foo.png has
stem foo and ext .png, then split_extension(foo) has no extension, so
no double; but foo.png.png has stem foo.png and ext .png, then
split_extension(foo.png) also returns .png — same extension twice).
Strip the outer spurious extension before generating the dark/light pair.
Closes quarto-dev/quarto-cli#14583
8ced107 to
cf3927e
Compare
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.
The Positron screenshot was broken on the Python, R, and Julia computations pages and images showed as missing.
The root cause is in how Quarto encodes shortcodes before handing the document to Pandoc. See quarto-dev/quarto-cli#14583 for details.
The filter now checks for the double-extension case (same extension appearing twice) and strips the outer spurious one before building the dark and light image paths. This makes the filter robust for any
{{< meta >}}+.include-darkcombination until the root cause is fixed upstream in the qmd reader. This is more a workaround than an actual fix, but it at least fix the issue in the documentation with minimal change.Closes quarto-dev/quarto-cli#14583