Skip to content

“Just” print a Markdown table #13551

@kellertuer

Description

@kellertuer

Bug description

I have some table data in Jluia that I want to format a bit and “just” want to print that in markdown - plain markdown so it can get rendered later. I only manage to get the Markdown table when I put the output to code but then I also only get a code cell with the markdown code of the table not the table itself

Steps to reproduce

Use the JuliaNotebookRunnger (engine: julia) on the following .qmd where your Julia environment should at least have the two packages used installed

```{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"])
```

Actual behavior

      [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]

Expected behavior

The last output should be the second to last output with 4 spaces less upfront so I have a Markdown table (not the code of a markdown table) in the result if I continue with the markdown (e.g. through Julia Docu,emter.jl) - or as in the example above the output should read

``` 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"])
```
| **A** | **B** |
|------:|------:|
|     1 |     4 |
|     2 |     5 |
|     3 |     6 |

(or the last 5 lines here instead of [TABLE] above)

Your environment

  • VS Code (but should not matter) or just terminal
  • Mac OS 26
  • quarto 1.8.25
  • QuartoNotebookRunner.jl 0.17.4
  • Julia 1.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    supporta request for support

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions