yihui / knitr

A general-purpose tool for dynamic report generation in R
https://yihui.org/knitr/
2.36k stars 873 forks source link

Support knitr.svg.object in Quarto #2278

Closed brianmsm closed 10 months ago

brianmsm commented 11 months ago

I am not sure if this corresponds to knitr. I saw this implementation (https://github.com/yihui/knitr/issues/2152) and thought it was fantastic because it's something I've been looking for a long time. In rmarkdown it works fine, but the rendering in quarto, not anymore by setting the self-contained to true or false.

---
title: "test4"
format:
  html: 
    self-contained: false
    keep-md: true
---

```{r setup, echo=FALSE}
knitr::opts_chunk$set(fig.path = "fig2/", dev = "gridSVG")
options(knitr.svg.object = TRUE)

Plot test

library(ggplot2)
ggplot(mpg, aes(class)) + geom_bar()

This is the result of the compiled md:

````md
---
title: "test4"
format:
  html: 
    self-contained: false
    keep-md: true
---

::: {.cell}

:::

# Plot test

::: {.cell}

```{.r .cell-code}
library(ggplot2)
ggplot(mpg, aes(class)) + geom_bar()

::: {.cell-output-display} {width=672} ::: :::


<details style="margin-bottom:10px;">
<summary>
SVG file
</summary>

```svg
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="504px" height="360px" viewBox="0 0 504 360" version="1.1">
  <metadata xmlns:gridsvg="http://www.stat.auckland.ac.nz/~paul/R/gridSVG/">
    <gridsvg:generator name="gridSVG" version="1.7-5" time="2023-08-08 15:09:30.277402"/>
    <gridsvg:argument name="name" value="fig2/unnamed-chunk-1-1.svg~"/>
    <gridsvg:argument name="exportCoords" value="none"/>
    <gridsvg:argument name="exportMappings" value="none"/>
    <gridsvg:argument name="exportJS" value="none"/>
    <gridsvg:argument name="res" value="72"/>
    <gridsvg:argument name="prefix" value=""/>
    <gridsvg:argument name="addClasses" value="FALSE"/>
    <gridsvg:argument name="indent" value="TRUE"/>
    <gridsvg:argument name="htmlWrapper" value="FALSE"/>
    <gridsvg:argument name="usePaths" value="vpPaths"/>
    <gridsvg:argument name="uniqueNames" value="TRUE"/>
    <gridsvg:separator name="id.sep" value="."/>
    <gridsvg:separator name="gPath.sep" value="::"/>
    <gridsvg:separator name="vpPath.sep" value="::"/>
  </metadata>
  <g transform="translate(0, 360) scale(1, -1)">
    <g id="gridSVG" fill="rgb(255,255,255)" stroke="rgb(0,0,0)" stroke-dasharray="none" stroke-width="0.75" font-size="12" font-family="Helvetica, Arial, FreeSans, Liberation Sans, Nimbus Sans L, sans-serif" opacity="1" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-opacity="1" fill-opacity="1" font-weight="normal" font-style="normal">
      <g id="layout.1">
        <g id="layout.2">
          <defs>
            <clipPath id="layout::background.1-9-12-1.1.clipPath">
              <rect x="0" y="0" width="504" height="360" fill="none" stroke="none"/>
            </clipPath>
          </defs>
          <g id="layout::background.1-9-12-1.1" clip-path="url(#layout::background.1-9-12-1.1.clipPath)">
            <g id="background.1-9-12-1.1">
              <g id="plot.background..rect.37.1">
                <rect id="plot.background..rect.37.1.1" x="0" y="0" width="504" height="360" transform="" stroke-width="1.07" stroke="rgb(255,255,255)" fill="rgb(255,255,255)" stroke-dasharray="none" stroke-opacity="1" fill-opacity="1"/>
              </g>
            </g>
          </g>
          <defs>
            <clipPath id="layout::panel.7-5-7-5.1.clipPath">
              <rect x="34.57" y="33.55" width="463.95" height="320.97" fill="none" stroke="none"/>
            </clipPath>
          </defs>
          <g id="layout::panel.7-5-7-5.1" clip-path="url(#layout::panel.7-5-7-5.1.clipPath)">
            <g id="panel.7-5-7-5.1">
              <g id="panel-1.gTree.15.1">
                <g id="grill.gTree.13.1">
                  <g id="panel.background..rect.6.1">
                    <rect id="panel.background..rect.6.1.1" x="34.57" y="33.55" width="463.95" height="320.97" transform="" stroke-width="1.07" stroke="none" fill="rgb(235,235,235)" stroke-dasharray="none" stroke-opacity="0" fill-opacity="1"/>
                  </g>
                  <g id="panel.grid.minor.y..polyline.8.1">
                    <polyline id="panel.grid.minor.y..polyline.8.1.1" points="34.57,95.2 498.52,95.2" stroke="rgb(255,255,255)" fill="none" stroke-width="0.53" stroke-dasharray="none" stroke-linecap="butt" stroke-opacity="1" fill-opacity="1"/>
                    <polyline id="panel.grid.minor.y..polyline.8.1.2" points="34.57,189.33 498.52,189.33" stroke="rgb(255,255,255)" fill="none" stroke-width="0.53" stroke-dasharray="none" stroke-linecap="butt" stroke-opacity="1" fill-opacity="1"/>
                    <polyline id="panel.grid.minor.y..polyline.8.1.3" points="34.57,283.46 498.52,283.46" stroke="rgb(255,255,255)" fill="none" stroke-width="0.53" stroke-dasharray="none" stroke-linecap="butt" stroke-opacity="1" fill-opacity="1"/>
                  </g>
                  <g id="panel.grid.major.y..polyline.10.1">
                    <polyline id="panel.grid.major.y..polyline.10.1.1" points="34.57,48.14 498.52,48.14" stroke="rgb(255,255,255)" fill="none" stroke-width="1.07" stroke-dasharray="none" stroke-linecap="butt" stroke-opacity="1" fill-opacity="1"/>
                    <polyline id="panel.grid.major.y..polyline.10.1.2" points="34.57,142.27 498.52,142.27" stroke="rgb(255,255,255)" fill="none" stroke-width="1.07" stroke-dasharray="none" stroke-linecap="butt" stroke-opacity="1" fill-opacity="1"/>
                    <polyline id="panel.grid.major.y..polyline.10.1.3" points="34.57,236.39 498.52,236.39" stroke="rgb(255,255,255)" fill="none" stroke-width="1.07" stroke-dasharray="none" stroke-linecap="butt" stroke-opacity="1" fill-opacity="1"/>
                    <polyline id="panel.grid.major.y..polyline.10.1.4" points="34.57,330.52 498.52,330.52" stroke="rgb(255,255,255)" fill="none" stroke-width="1.07" stroke-dasharray="none" stroke-linecap="butt" stroke-opacity="1" fill-opacity="1"/>
                  </g>
                  <g id="panel.grid.major.x..polyline.12.1">
                    <polyline id="panel.grid.major.x..polyline.12.1.1" points="73.23,33.55 73.23,354.52" stroke="rgb(255,255,255)" fill="none" stroke-width="1.07" stroke-dasharray="none" stroke-linecap="butt" stroke-opacity="1" fill-opacity="1"/>
                    <polyline id="panel.grid.major.x..polyline.12.1.2" points="137.67,33.55 137.67,354.52" stroke="rgb(255,255,255)" fill="none" stroke-width="1.07" stroke-dasharray="none" stroke-linecap="butt" stroke-opacity="1" fill-opacity="1"/>
                    <polyline id="panel.grid.major.x..polyline.12.1.3" points="202.11,33.55 202.11,354.52" stroke="rgb(255,255,255)" fill="none" stroke-width="1.07" stroke-dasharray="none" stroke-linecap="butt" stroke-opacity="1" fill-opacity="1"/>
                    <polyline id="panel.grid.major.x..polyline.12.1.4" points="266.55,33.55 266.55,354.52" stroke="rgb(255,255,255)" fill="none" stroke-width="1.07" stroke-dasharray="none" stroke-linecap="butt" stroke-opacity="1" fill-opacity="1"/>
                    <polyline id="panel.grid.major.x..polyline.12.1.5" points="330.98,33.55 330.98,354.52" stroke="rgb(255,255,255)" fill="none" stroke-width="1.07" stroke-dasharray="none" stroke-linecap="butt" stroke-opacity="1" fill-opacity="1"/>
                    <polyline id="panel.grid.major.x..polyline.12.1.6" points="395.42,33.55 395.42,354.52" stroke="rgb(255,255,255)" fill="none" stroke-width="1.07" stroke-dasharray="none" stroke-linecap="butt" stroke-opacity="1" fill-opacity="1"/>
                    <polyline id="panel.grid.major.x..polyline.12.1.7" points="459.86,33.55 459.86,354.52" stroke="rgb(255,255,255)" fill="none" stroke-width="1.07" stroke-dasharray="none" stroke-linecap="butt" stroke-opacity="1" fill-opacity="1"/>
                  </g>
                </g>
                <g id="geom_rect.rect.2.1">
                  <rect id="geom_rect.rect.2.1.1" x="44.24" y="48.14" width="57.99" height="23.53" transform="" stroke="none" fill="rgb(89,89,89)" stroke-width="1.07" stroke-dasharray="none" stroke-linejoin="miter" stroke-linecap="butt" stroke-opacity="0" fill-opacity="1"/>
                  <rect id="geom_rect.rect.2.1.2" x="108.67" y="48.14" width="57.99" height="221.2" transform="" stroke="none" fill="rgb(89,89,89)" stroke-width="1.07" stroke-dasharray="none" stroke-linejoin="miter" stroke-linecap="butt" stroke-opacity="0" fill-opacity="1"/>
                  <rect id="geom_rect.rect.2.1.3" x="173.11" y="48.14" width="57.99" height="192.96" transform="" stroke="none" fill="rgb(89,89,89)" stroke-width="1.07" stroke-dasharray="none" stroke-linejoin="miter" stroke-linecap="butt" stroke-opacity="0" fill-opacity="1"/>
                  <rect id="geom_rect.rect.2.1.4" x="237.55" y="48.14" width="57.99" height="51.77" transform="" stroke="none" fill="rgb(89,89,89)" stroke-width="1.07" stroke-dasharray="none" stroke-linejoin="miter" stroke-linecap="butt" stroke-opacity="0" fill-opacity="1"/>
                  <rect id="geom_rect.rect.2.1.5" x="301.99" y="48.14" width="57.99" height="155.31" transform="" stroke="none" fill="rgb(89,89,89)" stroke-width="1.07" stroke-dasharray="none" stroke-linejoin="miter" stroke-linecap="butt" stroke-opacity="0" fill-opacity="1"/>
                  <rect id="geom_rect.rect.2.1.6" x="366.42" y="48.14" width="57.99" height="164.72" transform="" stroke="none" fill="rgb(89,89,89)" stroke-width="1.07" stroke-dasharray="none" stroke-linejoin="miter" stroke-linecap="butt" stroke-opacity="0" fill-opacity="1"/>
                  <rect id="geom_rect.rect.2.1.7" x="430.86" y="48.14" width="57.99" height="291.79" transform="" stroke="none" fill="rgb(89,89,89)" stroke-width="1.07" stroke-dasharray="none" stroke-linejoin="miter" stroke-linecap="butt" stroke-opacity="0" fill-opacity="1"/>
                </g>
              </g>
            </g>
          </g>
          <g id="layout::spacer.8-6-8-6.1">
            <g id="spacer.8-6-8-6.1"/>
          </g>
          <g id="layout::spacer.8-4-8-4.1">
            <g id="spacer.8-4-8-4.1"/>
          </g>
          <g id="layout::spacer.6-6-6-6.1">
            <g id="spacer.6-6-6-6.1"/>
          </g>
          <g id="layout::spacer.6-4-6-4.1">
            <g id="spacer.6-4-6-4.1"/>
          </g>
          <g id="layout::axis-t.6-5-6-5.1">
            <g id="axis-t.6-5-6-5.1"/>
          </g>
          <g id="layout::axis-l.7-4-7-4.1">
            <g id="axis-l.7-4-7-4.1">
              <g id="layout::axis-l.7-4-7-4::GRID.VP.6.1">
                <g id="GRID.absoluteGrob.24.1">
                  <g id="layout::axis-l.7-4-7-4::GRID.VP.6::axis.1">
                    <g id="axis.1">
                      <g id="layout::axis-l.7-4-7-4::GRID.VP.6::axis::axis.1-1-1-1.1">
                        <g id="axis.1-1-1-1.1">
                          <g id="layout::axis-l.7-4-7-4::GRID.VP.6::axis::axis.1-1-1-1::GRID.VP.4.1" font-size="8.8" stroke="rgb(77,77,77)" font-family="Helvetica, Arial, FreeSans, Liberation Sans, Nimbus Sans L, sans-serif" stroke-opacity="1" font-weight="normal" font-style="normal">
                            <g id="layout::axis-l.7-4-7-4::GRID.VP.6::axis::axis.1-1-1-1::GRID.VP.4::GRID.VP.5.1">
                              <g id="GRID.titleGrob.22.1">
                                <g id="GRID.text.21.1">
                                  <g id="GRID.text.21.1.1" transform="translate(29.64, 48.14)" stroke-width="0.1">
                                    <g id="GRID.text.21.1.1.scale" transform="scale(1, -1)">
                                      <text x="0" y="0" id="GRID.text.21.1.1.text" text-anchor="end" font-size="8.8" stroke="rgb(77,77,77)" font-family="Helvetica, Arial, FreeSans, Liberation Sans, Nimbus Sans L, sans-serif" fill="rgb(77,77,77)" stroke-opacity="1" fill-opacity="1" font-weight="normal" font-style="normal">
                                        <tspan id="GRID.text.21.1.1.tspan.1" dy="3.5" x="0">0</tspan>
                                      </text>
                                    </g>
                                  </g>
                                  <g id="GRID.text.21.1.2" transform="translate(29.64, 142.27)" stroke-width="0.1">
                                    <g id="GRID.text.21.1.2.scale" transform="scale(1, -1)">
                                      <text x="0" y="0" id="GRID.text.21.1.2.text" text-anchor="end" font-size="8.8" stroke="rgb(77,77,77)" font-family="Helvetica, Arial, FreeSans, Liberation Sans, Nimbus Sans L, sans-serif" fill="rgb(77,77,77)" stroke-opacity="1" fill-opacity="1" font-weight="normal" font-style="normal">
                                        <tspan id="GRID.text.21.1.2.tspan.1" dy="3.5" x="0">20</tspan>
                                      </text>
                                    </g>
                                  </g>
                                  <g id="GRID.text.21.1.3" transform="translate(29.64, 236.39)" stroke-width="0.1">
                                    <g id="GRID.text.21.1.3.scale" transform="scale(1, -1)">
                                      <text x="0" y="0" id="GRID.text.21.1.3.text" text-anchor="end" font-size="8.8" stroke="rgb(77,77,77)" font-family="Helvetica, Arial, FreeSans, Liberation Sans, Nimbus Sans L, sans-serif" fill="rgb(77,77,77)" stroke-opacity="1" fill-opacity="1" font-weight="normal" font-style="normal">
                                        <tspan id="GRID.text.21.1.3.tspan.1" dy="3.5" x="0">40</tspan>
                                      </text>
                                    </g>
                                  </g>
                                  <g id="GRID.text.21.1.4" transform="translate(29.64, 330.52)" stroke-width="0.1">
                                    <g id="GRID.text.21.1.4.scale" transform="scale(1, -1)">
                                      <text x="0" y="0" id="GRID.text.21.1.4.text" text-anchor="end" font-size="8.8" stroke="rgb(77,77,77)" font-family="Helvetica, Arial, FreeSans, Liberation Sans, Nimbus Sans L, sans-serif" fill="rgb(77,77,77)" stroke-opacity="1" fill-opacity="1" font-weight="normal" font-style="normal">
                                        <tspan id="GRID.text.21.1.4.tspan.1" dy="3.5" x="0">60</tspan>
                                      </text>
                                    </g>
                                  </g>
                                </g>
                              </g>
                            </g>
                          </g>
                        </g>
                      </g>
                      <g id="layout::axis-l.7-4-7-4::GRID.VP.6::axis::axis.1-2-1-2.1">
                        <g id="axis.1-2-1-2.1">
                          <g id="GRID.polyline.23.1">
                            <polyline id="GRID.polyline.23.1.1" points="31.83,48.14 34.57,48.14" stroke="rgb(51,51,51)" fill="none" stroke-width="1.07" stroke-dasharray="none" stroke-linecap="butt" stroke-opacity="1" fill-opacity="1"/>
                            <polyline id="GRID.polyline.23.1.2" points="31.83,142.27 34.57,142.27" stroke="rgb(51,51,51)" fill="none" stroke-width="1.07" stroke-dasharray="none" stroke-linecap="butt" stroke-opacity="1" fill-opacity="1"/>
                            <polyline id="GRID.polyline.23.1.3" points="31.83,236.39 34.57,236.39" stroke="rgb(51,51,51)" fill="none" stroke-width="1.07" stroke-dasharray="none" stroke-linecap="butt" stroke-opacity="1" fill-opacity="1"/>
                            <polyline id="GRID.polyline.23.1.4" points="31.83,330.52 34.57,330.52" stroke="rgb(51,51,51)" fill="none" stroke-width="1.07" stroke-dasharray="none" stroke-linecap="butt" stroke-opacity="1" fill-opacity="1"/>
                          </g>
                        </g>
                      </g>
                    </g>
                  </g>
                </g>
              </g>
            </g>
          </g>
          <g id="layout::axis-r.7-6-7-6.1">
            <g id="axis-r.7-6-7-6.1"/>
          </g>
          <g id="layout::axis-b.8-5-8-5.1">
            <g id="axis-b.8-5-8-5.1">
              <g id="layout::axis-b.8-5-8-5::GRID.VP.3.1">
                <g id="GRID.absoluteGrob.20.1">
                  <g id="layout::axis-b.8-5-8-5::GRID.VP.3::axis.1">
                    <g id="axis.2">
                      <g id="layout::axis-b.8-5-8-5::GRID.VP.3::axis::axis.1-1-1-1.1">
                        <g id="axis.1-1-1-1.2">
                          <g id="GRID.polyline.19.1">
                            <polyline id="GRID.polyline.19.1.1" points="73.23,30.81 73.23,33.55" stroke="rgb(51,51,51)" fill="none" stroke-width="1.07" stroke-dasharray="none" stroke-linecap="butt" stroke-opacity="1" fill-opacity="1"/>
                            <polyline id="GRID.polyline.19.1.2" points="137.67,30.81 137.67,33.55" stroke="rgb(51,51,51)" fill="none" stroke-width="1.07" stroke-dasharray="none" stroke-linecap="butt" stroke-opacity="1" fill-opacity="1"/>
                            <polyline id="GRID.polyline.19.1.3" points="202.11,30.81 202.11,33.55" stroke="rgb(51,51,51)" fill="none" stroke-width="1.07" stroke-dasharray="none" stroke-linecap="butt" stroke-opacity="1" fill-opacity="1"/>
                            <polyline id="GRID.polyline.19.1.4" points="266.55,30.81 266.55,33.55" stroke="rgb(51,51,51)" fill="none" stroke-width="1.07" stroke-dasharray="none" stroke-linecap="butt" stroke-opacity="1" fill-opacity="1"/>
                            <polyline id="GRID.polyline.19.1.5" points="330.98,30.81 330.98,33.55" stroke="rgb(51,51,51)" fill="none" stroke-width="1.07" stroke-dasharray="none" stroke-linecap="butt" stroke-opacity="1" fill-opacity="1"/>
                            <polyline id="GRID.polyline.19.1.6" points="395.42,30.81 395.42,33.55" stroke="rgb(51,51,51)" fill="none" stroke-width="1.07" stroke-dasharray="none" stroke-linecap="butt" stroke-opacity="1" fill-opacity="1"/>
                            <polyline id="GRID.polyline.19.1.7" points="459.86,30.81 459.86,33.55" stroke="rgb(51,51,51)" fill="none" stroke-width="1.07" stroke-dasharray="none" stroke-linecap="butt" stroke-opacity="1" fill-opacity="1"/>
                          </g>
                        </g>
                      </g>
                      <g id="layout::axis-b.8-5-8-5::GRID.VP.3::axis::axis.2-1-2-1.1">
                        <g id="axis.2-1-2-1.1">
                          <g id="layout::axis-b.8-5-8-5::GRID.VP.3::axis::axis.2-1-2-1::GRID.VP.1.1" font-size="8.8" stroke="rgb(77,77,77)" font-family="Helvetica, Arial, FreeSans, Liberation Sans, Nimbus Sans L, sans-serif" stroke-opacity="1" font-weight="normal" font-style="normal">
                            <g id="layout::axis-b.8-5-8-5::GRID.VP.3::axis::axis.2-1-2-1::GRID.VP.1::GRID.VP.2.1">
                              <g id="GRID.titleGrob.18.1">
                                <g id="GRID.text.16.1">
                                  <g id="GRID.text.16.1.1" transform="translate(73.23, 28.62)" stroke-width="0.1">
                                    <g id="GRID.text.16.1.1.scale" transform="scale(1, -1)">
                                      <text x="0" y="0" id="GRID.text.16.1.1.text" text-anchor="middle" font-size="8.8" stroke="rgb(77,77,77)" font-family="Helvetica, Arial, FreeSans, Liberation Sans, Nimbus Sans L, sans-serif" fill="rgb(77,77,77)" stroke-opacity="1" fill-opacity="1" font-weight="normal" font-style="normal">
                                        <tspan id="GRID.text.16.1.1.tspan.1" dy="7" x="0">2seater</tspan>
                                      </text>
                                    </g>
                                  </g>
                                  <g id="GRID.text.16.1.2" transform="translate(137.67, 28.62)" stroke-width="0.1">
                                    <g id="GRID.text.16.1.2.scale" transform="scale(1, -1)">
                                      <text x="0" y="0" id="GRID.text.16.1.2.text" text-anchor="middle" font-size="8.8" stroke="rgb(77,77,77)" font-family="Helvetica, Arial, FreeSans, Liberation Sans, Nimbus Sans L, sans-serif" fill="rgb(77,77,77)" stroke-opacity="1" fill-opacity="1" font-weight="normal" font-style="normal">
                                        <tspan id="GRID.text.16.1.2.tspan.1" dy="7" x="0">compact</tspan>
                                      </text>
                                    </g>
                                  </g>
                                  <g id="GRID.text.16.1.3" transform="translate(202.11, 28.62)" stroke-width="0.1">
                                    <g id="GRID.text.16.1.3.scale" transform="scale(1, -1)">
                                      <text x="0" y="0" id="GRID.text.16.1.3.text" text-anchor="middle" font-size="8.8" stroke="rgb(77,77,77)" font-family="Helvetica, Arial, FreeSans, Liberation Sans, Nimbus Sans L, sans-serif" fill="rgb(77,77,77)" stroke-opacity="1" fill-opacity="1" font-weight="normal" font-style="normal">
                                        <tspan id="GRID.text.16.1.3.tspan.1" dy="7" x="0">midsize</tspan>
                                      </text>
                                    </g>
                                  </g>
                                  <g id="GRID.text.16.1.4" transform="translate(266.55, 28.62)" stroke-width="0.1">
                                    <g id="GRID.text.16.1.4.scale" transform="scale(1, -1)">
                                      <text x="0" y="0" id="GRID.text.16.1.4.text" text-anchor="middle" font-size="8.8" stroke="rgb(77,77,77)" font-family="Helvetica, Arial, FreeSans, Liberation Sans, Nimbus Sans L, sans-serif" fill="rgb(77,77,77)" stroke-opacity="1" fill-opacity="1" font-weight="normal" font-style="normal">
                                        <tspan id="GRID.text.16.1.4.tspan.1" dy="7" x="0">minivan</tspan>
                                      </text>
                                    </g>
                                  </g>
                                  <g id="GRID.text.16.1.5" transform="translate(330.98, 28.62)" stroke-width="0.1">
                                    <g id="GRID.text.16.1.5.scale" transform="scale(1, -1)">
                                      <text x="0" y="0" id="GRID.text.16.1.5.text" text-anchor="middle" font-size="8.8" stroke="rgb(77,77,77)" font-family="Helvetica, Arial, FreeSans, Liberation Sans, Nimbus Sans L, sans-serif" fill="rgb(77,77,77)" stroke-opacity="1" fill-opacity="1" font-weight="normal" font-style="normal">
                                        <tspan id="GRID.text.16.1.5.tspan.1" dy="7" x="0">pickup</tspan>
                                      </text>
                                    </g>
                                  </g>
                                  <g id="GRID.text.16.1.6" transform="translate(395.42, 28.62)" stroke-width="0.1">
                                    <g id="GRID.text.16.1.6.scale" transform="scale(1, -1)">
                                      <text x="0" y="0" id="GRID.text.16.1.6.text" text-anchor="middle" font-size="8.8" stroke="rgb(77,77,77)" font-family="Helvetica, Arial, FreeSans, Liberation Sans, Nimbus Sans L, sans-serif" fill="rgb(77,77,77)" stroke-opacity="1" fill-opacity="1" font-weight="normal" font-style="normal">
                                        <tspan id="GRID.text.16.1.6.tspan.1" dy="7" x="0">subcompact</tspan>
                                      </text>
                                    </g>
                                  </g>
                                  <g id="GRID.text.16.1.7" transform="translate(459.86, 28.62)" stroke-width="0.1">
                                    <g id="GRID.text.16.1.7.scale" transform="scale(1, -1)">
                                      <text x="0" y="0" id="GRID.text.16.1.7.text" text-anchor="middle" font-size="8.8" stroke="rgb(77,77,77)" font-family="Helvetica, Arial, FreeSans, Liberation Sans, Nimbus Sans L, sans-serif" fill="rgb(77,77,77)" stroke-opacity="1" fill-opacity="1" font-weight="normal" font-style="normal">
                                        <tspan id="GRID.text.16.1.7.tspan.1" dy="7" x="0">suv</tspan>
                                      </text>
                                    </g>
                                  </g>
                                </g>
                              </g>
                            </g>
                          </g>
                        </g>
                      </g>
                    </g>
                  </g>
                </g>
              </g>
            </g>
          </g>
          <g id="layout::xlab-t.5-5-5-5.1">
            <g id="xlab-t.5-5-5-5.1"/>
          </g>
          <g id="layout::xlab-b.9-5-9-5.1">
            <g id="xlab-b.9-5-9-5.1">
              <g id="layout::xlab-b.9-5-9-5::GRID.VP.7.1" font-size="11" stroke="rgb(0,0,0)" font-family="Helvetica, Arial, FreeSans, Liberation Sans, Nimbus Sans L, sans-serif" stroke-opacity="1" font-weight="normal" font-style="normal">
                <g id="layout::xlab-b.9-5-9-5::GRID.VP.7::GRID.VP.8.1">
                  <g id="axis.title.x.bottom..titleGrob.28.1">
                    <g id="GRID.text.25.1">
                      <g id="GRID.text.25.1.1" transform="translate(266.55, 16.9)" stroke-width="0.1">
                        <g id="GRID.text.25.1.1.scale" transform="scale(1, -1)">
                          <text x="0" y="0" id="GRID.text.25.1.1.text" text-anchor="middle" font-size="11" stroke="rgb(0,0,0)" font-family="Helvetica, Arial, FreeSans, Liberation Sans, Nimbus Sans L, sans-serif" fill="rgb(0,0,0)" stroke-opacity="1" fill-opacity="1" font-weight="normal" font-style="normal">
                            <tspan id="GRID.text.25.1.1.tspan.1" dy="9" x="0">class</tspan>
                          </text>
                        </g>
                      </g>
                    </g>
                  </g>
                </g>
              </g>
            </g>
          </g>
          <g id="layout::ylab-l.7-3-7-3.1">
            <g id="ylab-l.7-3-7-3.1">
              <g id="layout::ylab-l.7-3-7-3::GRID.VP.9.1" font-size="11" stroke="rgb(0,0,0)" font-family="Helvetica, Arial, FreeSans, Liberation Sans, Nimbus Sans L, sans-serif" stroke-opacity="1" font-weight="normal" font-style="normal">
                <g id="layout::ylab-l.7-3-7-3::GRID.VP.9::GRID.VP.10.1">
                  <g id="axis.title.y.left..titleGrob.31.1">
                    <g id="GRID.text.29.1">
                      <g id="GRID.text.29.1.1" transform="translate(5.48, 194.04)" stroke-width="0.1">
                        <g id="GRID.text.29.1.1.scale" transform="scale(1, -1)">
                          <text x="0" y="0" id="GRID.text.29.1.1.text" transform="rotate(-90)" text-anchor="middle" font-size="11" stroke="rgb(0,0,0)" font-family="Helvetica, Arial, FreeSans, Liberation Sans, Nimbus Sans L, sans-serif" fill="rgb(0,0,0)" stroke-opacity="1" fill-opacity="1" font-weight="normal" font-style="normal">
                            <tspan id="GRID.text.29.1.1.tspan.1" dy="9" x="0">count</tspan>
                          </text>
                        </g>
                      </g>
                    </g>
                  </g>
                </g>
              </g>
            </g>
          </g>
          <g id="layout::ylab-r.7-7-7-7.1">
            <g id="ylab-r.7-7-7-7.1"/>
          </g>
          <g id="layout::subtitle.4-5-4-5.1">
            <g id="subtitle.4-5-4-5.1"/>
          </g>
          <g id="layout::title.3-5-3-5.1">
            <g id="title.3-5-3-5.1"/>
          </g>
          <g id="layout::caption.10-5-10-5.1">
            <g id="caption.10-5-10-5.1"/>
          </g>
          <g id="layout::tag.2-2-2-2.1">
            <g id="tag.2-2-2-2.1"/>
          </g>
        </g>
      </g>
    </g>
  </g>
</svg>


> xfun::session_info('knitr')
R version 4.3.1 (2023-06-16)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Garuda Linux, RStudio 2023.6.1.524

Locale:
  LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8   
  LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
  LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

time zone: America/Lima
tzcode source: system (glibc)

Package version:
  evaluate_0.21   graphics_4.3.1  grDevices_4.3.1 highr_0.10      knitr_1.43.2    methods_4.3.1   stats_4.3.1     tools_4.3.1    
  utils_4.3.1     xfun_0.39       yaml_2.3.7 

By filing an issue to this repo, I promise that

I understand that my issue may be closed if I don't fulfill my promises.

cderv commented 10 months ago

Thanks for the report @brianmsm !

This would be a feature request for Quarto. As of now, Quarto is overriding the knitr's plot hooks to only output markdown syntax to include images, and let Pandoc and internal Quarto handling to create the right outputs. That is why you see

![](fig/unnamed-chunk-1-1.svg){width=672}

Then it seems nor Quarto or Pandoc does insertion of svg using <object>

@JooYoungseo you were the one requesting #2152 and helping with <object> inclusion. Did you already report this improvment on the Quarto side ? Are you aware of current Quarto limitation on that matter ?

We may need to work on this together for Quarto. What do you think ?

cderv commented 10 months ago

FWIW it was discussed in Pandoc at

and they recommend Lua filter to use <object> for svg image, so I think we can do that in Quarto.

cderv commented 10 months ago

I have open

so I'll close this here.

Thanks !

github-actions[bot] commented 4 months ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.