# Strange Quarto output using PrettyTables

**URL:** https://discourse.julialang.org/t/strange-quarto-output-using-prettytables/133104
**Category:** General Usage
**Created:** [October 13, 2025, 9:07am UTC](https://discourse.julialang.org/t/strange-quarto-output-using-prettytables/133104 "2025-10-13T09:07:33Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![kellertuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kellertuer/32/220707_2.png) [@kellertuer](https://discourse.julialang.org/u/kellertuer)
#### Post date: [October 13, 2025, 9:07am UTC](https://discourse.julialang.org/t/strange-quarto-output-using-prettytables/133104/1 "2025-10-13T09:07:33Z")

</div>

I have a relatively simple task I want to achieve: Render a quarto notebook into Markdown, so that I can include it in my docs.  
I am of course running QuartoNotebookRunner.jl.

When I have to work with tables, using PrettyTables.jl would be nice to have, I think. However, I can not get that to work. Here is an (n)MWE, where the project in the same folder as the `qmd` file should contain Also DataFrames.jl

````julia-auto
```{julia}
using Pkg;
cd(@ __DIR__ )
Pkg.activate(".");
Pkg.status() # just to illustrate package versions below
```
```{julia}
#| output: false
using PrettyTables, DataFrames
df = DataFrame(:a => [1,2,3], :b => [4,5,6])
```
```{julia}
# printing into normal output/code I get a nice markdown table,
# but this does only render in code and not as a nice markdown table
pretty_table(df, backend = :markdown, column_labels = ["A", "B"])
```
```{julia}
#| output: asis
# This `output: asis` should do the same as above without the code env, but always and only prints [TABLE]
# instead. Why? and how to fix this?
pretty_table(df, backend = :markdown, column_labels = ["A", "B"])
```

````

As the comments in the code suggest the result is a bit unsatisfying: The first pretty print is a code cell, so that does not render into a table in the following. The second (or fourth cell) I hoped to get what I hoped for, but:

````julia-auto
      [a93c6f00] DataFrames v1.8.0
      [08abe8d2] PrettyTables v3.1.0

``` julia
# printing into normal output/code I get a nice markdown table,
# but this does only render in code and not as a nice markdown table
pretty_table(df, backend = :markdown, column_labels = ["A", "B"])
```

    | **A** | **B** |
    |------:|------:|
    | 1 | 4 |
    | 2 | 5 |
    | 3 | 6 |

``` julia
# This `output: asis` should do the same as above without the code env, but always and only prints [TABLE]
# instead. Why? and how to fix this?
pretty_table(df, backend = :markdown, column_labels = ["A", "B"])
```

[TABLE]

````

So Why does the last cell not just do the same as the second to last just without the 4 spaces upfront? I can not get this to work. Any hints appreciated.

---

<div class="post-metadata">

### Author: ![kellertuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kellertuer/32/220707_2.png) [@kellertuer](https://discourse.julialang.org/u/kellertuer)
#### Post date: [October 14, 2025, 1:30pm UTC](https://discourse.julialang.org/t/strange-quarto-output-using-prettytables/133104/2 "2025-10-14T13:30:47Z")

</div>

I also posted it [here](https://github.com/quarto-dev/quarto/issues/849) with quarto, because if one captures the result in a string and prints that it depends on whether the line before the table is empty or not whether it is printed correctly (for no empty line) or not.

---

<div class="post-metadata">

### Author: ![kellertuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kellertuer/32/220707_2.png) [@kellertuer](https://discourse.julialang.org/u/kellertuer)
#### Post date: [October 18, 2025, 9:37am UTC](https://discourse.julialang.org/t/strange-quarto-output-using-prettytables/133104/3 "2025-10-18T09:37:23Z")

</div>

Here is one possible solution. For Documenter.jl we need ´commonmark´ as a format. We do want to avoid that e.g. images are refactored to HTML, which is valid Markdown but would not work with Documenter, and let’s keep Math TeX in `$`. The `-raw_html` also turns (already transformed) HTML tables into `[TABLE]`. The solution to that is to add `+pipe_tables` to keep piped tables.  
Overall:

```julia-auto
format:
  commonmark:
    variant: +pipe_tables+tex_math_dollars-raw_html
    wrap: preserve

```
