Skip to content

Conversation

@jgostick
Copy link
Contributor

@jgostick jgostick commented Nov 7, 2023

The R instructions call kable twice to produce the 2 tables, but in python calling Markdown twice does not work. Instead I found that Markdown(table1 + table2) seems to work, so I created a tabset with instructions for R and Python.

…nal block

The R instructions call `kable` twice to produce the 2 tables, but in python calling `Markdown` twice does not work. Instead I found that `Markdown(table1 + table2)` seems to work, so I created a `tabset` with instructions for R and Python.
@jjallaire jjallaire merged commit 51d5be7 into quarto-dev:main Nov 7, 2023
@jjallaire
Copy link
Collaborator

Thanks! Another way to go for Python is to use the display function (e.g. display(Markdown(cars))). I also think we might need a to_markdown() call on the data frames. I'll update the example and ping this thread back when that's done.

@jgostick
Copy link
Contributor Author

jgostick commented Nov 7, 2023

Yes, your suggestion of display(Markdown(tbl1)) is much preferred since mine breaks if the tables don't happen to have \n before and after them! So sorry that I didn't do my due diligence on this. I was using cut/pasted tables in my IDE, and noticed just now that my real "generated" tables don't quite work the same. Should I do another PR to fix this up? I don't want to create a lot of noise for you over the sake of 1 line.

EDIT: I should add that it now works with two calls to display, like:

display(Markdown(table1))
display(Markdown(table2))

@jjallaire
Copy link
Collaborator

I created a revision version here: https://quarto.org/docs/authoring/tables.html#computations

This uses display() and also documents how to import it as well as the use of the index = False parameter.

@jgostick
Copy link
Contributor Author

jgostick commented Nov 7, 2023

You are a champion, and quarto is the greatest piece of software I have used in a long, long time. I am writing a textbook with this, so hopefully I can add it to the prestigious example gallery one day in the not too distant future. Cheers!

cderv added a commit to cderv/quarto-web that referenced this pull request Nov 7, 2023
@jjallaire
Copy link
Collaborator

Thanks for the kind words and so happy to hear you are having success using Quarto for your book!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants