Open Huttsa opened 6 months ago
I do thing this is similar to other issues regarding embed with .qmd
. This other one is about HTML table feature for example ()
Embed for .qmd works this way:
I can reproduce your issue and I see a message about Tabset panel feature not being support for output format and so default rendering will happen.
The intermediate .md will have this content
::: {#cell-fig-mtcars .cell}
```{.r .cell-code}
#| label: fig-mtcars
library(tidyverse)
::: {.cell-output .cell-output-stderr}
:::
#| label: fig-mtcars
ggplot(data = mtcars, aes(x = mpg)) +
geom_histogram() +
labs(x = "Miles Per Gallon (mpg)", y = "Count", title = "Distribution of MPG in mtcars")
::: {.cell-output .cell-output-stderr}
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
:::
::: {.cell-output-display} {#fig-mtcars} ::: :::
::: panel-tabset
::: {#cell-fig-inpanel .cell}
#| label: fig-inpanel
library(tidyverse)
ggplot(data = mtcars, aes(x = mpg)) +
geom_histogram() +
labs(x = "Miles Per Gallon (mpg)", y = "Count", title = "Distribution of MPG in mtcars")
::: {.cell-output .cell-output-stderr}
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
:::
::: {.cell-output-display} {#fig-inpanel} ::: :::
Some text :::
but when converted to .ipynb, the content is for the first part
```json
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
<!-- truncated -->
]
},
{
"output_type": "stream",
"name": "stderr",
"text": [
"`stat_bin()` using `bins = 30`. Pick better value with `binwidth`."
]
},
{
"output_type": "display_data",
"metadata": {},
"data": {
"image/png":
<!-- truncated -->
}
}
],
"source": [
"#| label: fig-mtcars\n",
"\n",
"library(tidyverse)"
],
"id": "cell-fig-mtcars"
},
and for the tabset part
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Test\n",
"\n",
"``` r\n",
"#| label: fig-inpanel\n",
"\n",
"library(tidyverse)\n",
"\n",
"ggplot(data = mtcars, aes(x = mpg)) +\n",
" geom_histogram() +\n",
" labs(x = \"Miles Per Gallon (mpg)\", y = \"Count\", title = \"Distribution of MPG in mtcars\")\n",
"```\n",
"\n",
" `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.\n",
"\n",
"![](attachment:nbsource_files/figure-ipynb/fig-inpanel-1.png)\n",
"\n",
"## not test\n",
"\n",
"Some text"
],
"attachments": {
"nbsource_files/figure-ipynb/fig-inpanel-1.png": {
"image/png":
<!-- truncated -->
}
},
"id": "6d871be6-3b48-48be-966c-7dd70eda9f41"
}
],
For the first we get a specific cell with the id set with fig-mtcars
and this allow detection and inclusion of content.
For the second, the cell id is random and mardown content (and not display data
). It contains both the content of the tabsets as markdown output, including the fig-inpanel
.
So the ::: {#cell-fig-inpanel .cell}
is lost and it not split. It would need to be two differents cells in the output for the embed feature to work in such case.
So currently, this means that embedding content from cell that is inside a Tabset Panels does not work.
This would need improvement in rendering to ipynb and detection of the cell.
Bug description
I ran into this issue with a project and I tried reproducing it with just the basic Quarto manuscript project. Not sure if I have missed something in the documentation or whether this an actual bug, but decided to make a not of it.
Steps to reproduce
{{< embed notebooks/nbsource.qmd#fig-mtcars >}}
Another embed but this time in panel
{{< embed notebooks/nbsource.qmd#fig-inpanel >}}
::: panel-tabset
Test
not test
Some text :::