How do I generate two column format with python? #12684
Answered
by
gordonwoodhull
stefaniecg
asked this question in
Q&A
-
DescriptionI need to generate a column format in a quarto report using python. Thank you for the help you can provide :) ---
title: Column generation
author: me
---
## Generated direct
This works ok.
::: {layout-ncol=2}
column1
column2
:::
## Generated with python
This does not work.
```{python}
from IPython.display import display, Markdown
display(Markdown('## I need to be able to generate it like this'))
display(Markdown('::: {layout-ncol=2}'))
display(Markdown('column1\n'))
display(Markdown('\n'))
display(Markdown('column2\n'))
display(Markdown(':::'))
display(Markdown('\n'))
|
Beta Was this translation helpful? Give feedback.
Answered by
gordonwoodhull
May 5, 2025
Replies: 1 comment 2 replies
-
Quarto's Jupyter engine will output each To debug this, you can see what happens with So if you want to build fenced divs programmatically, the easiest (and perhaps only) way is to put it all in one Markdown string, This works:
|
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
stefaniecg
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Quarto's Jupyter engine will output each
display(Markdown(...))
in its own fenced div block.To debug this, you can see what happens with
keep-md:true
and look at the.html.md
output.So if you want to build fenced divs programmatically, the easiest (and perhaps only) way is to put it all in one Markdown string,
This works: