tidyverse/vroom

Output of vroom::vroom does not display properly in Quarto HTML

allefeld opened this issue · 4 comments

This is what it looks like in an R session in a terminal:

image

This is what it looks like in a Quarto document rendered to HTML:

image

I obviously don't expect the terminal colors to be reproduced. But beyond that, output seems to be out of order, line breaks are not respected etc.

In case this is a bug in Quarto and not in vroom, I'm tagging @cscheid.

@allefeld Can you provide a minimal example I can run myself?

Here it is:

File test.qmd:

```{r}
df <- vroom::vroom("test.csv")
```

File test.csv (intentionally broken to trigger messages from vroom:

,Column 2,12
1,2,
,3,

Screenshot from rendered test.html:

image

Screenshot from same code run in a terminal:

image

Cell output HTML code:

<div class="cell-output cell-output-stderr">
<pre><code>New names:
Rows: 2 Columns: 3
── Column specification
──────────────────────────────────────────────────────── Delimiter: &quot;,&quot; dbl
(2): ...1, Column 2 lgl (1): 12
ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
Specify the column types or set `show_col_types = FALSE` to quiet this message.
• `` -&gt; `...1`</code></pre>
</div>

Thanks. This is the output of keep-md: true for me (which is the input that Quarto takes from knitr's output, effectively). It doesn't look like there's much that Quarto can do at this point:

---
title: vroom-537
keep-md: true
---


::: {.cell}

:::

::: {.cell}

```{.r .cell-code}
df <- vroom::vroom("test.csv")
```

::: {.cell-output .cell-output-stderr}

```
New names:
Rows: 2 Columns: 3
── Column specification
──────────────────────────────────────────────────────── Delimiter: "," dbl
(2): ...1, Column 2 lgl (1): 12
ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
Specify the column types or set `show_col_types = FALSE` to quiet this message.
• `` -> `...1`
```


:::
:::

Agreed, seems like vroom creates its output in a strange way. Control characters to move the cursor?