diff --git a/news/changelog-1.4.md b/news/changelog-1.4.md index 4b12d1fc867..f84ba15724a 100644 --- a/news/changelog-1.4.md +++ b/news/changelog-1.4.md @@ -82,6 +82,7 @@ - ([#7394](https://github.com/quarto-dev/quarto-cli/issues/7394)): Fix issue with mermaid diagrams in revealjs slides when `output-location: fragment`. - ([#4988](https://github.com/quarto-dev/quarto-cli/issues/4988)): targets for links on numbered code lines are removed, as revealjs doesn't support them because navigation is done by slide only. - ([#4156](https://github.com/quarto-dev/quarto-cli/issues/4156)): footer and slide number text on slide with dark background have now an adapted text muted color based on `$dark-bg-text-color`. +- ([#7134](https://github.com/quarto-dev/quarto-cli/issues/7134)): `.nostrech` can now be applied on image directly to opt-out Revealjs' image stretching when `auto-stretch: true` (the default). ## PDF Format diff --git a/src/format/reveal/format-reveal.ts b/src/format/reveal/format-reveal.ts index 7016188b617..d0257bd44f2 100644 --- a/src/format/reveal/format-reveal.ts +++ b/src/format/reveal/format-reveal.ts @@ -779,6 +779,12 @@ function applyStretch(doc: Document, autoStretch: boolean) { const image = images[0]; const imageEl = image as Element; + // opt-out if nostrech is applied at image level too + if (imageEl.classList.contains("nostretch")) { + imageEl.classList.remove("nostretch"); + continue; + } + if ( // screen out early specials divs (layout panels, columns, fragments, ...) findParent(imageEl, (el: Element) => {