-
I have a .qmd file (or jupyter notebook) that does a variety of computations but at the end produces a list. I have a TLDR at the top that just gives out the answers that are computed later, but at the moment I have to run all the cells (or render the document), get the list and then cut and paste back in the top. Is there any way to essentially run a cell near the top of the document last so it can update automatically/dynamically when rendered? It's not so bad with caching since the second render is fast, but it'd be nice if the opening section could just pull in data that is computed later... I'm pretty sure this is impossible at the moment... |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
You can probably do this but will require some intermediate to advanced hacking. You probably want to write a text file in the final cell that has access to the results and then read it at the top with a Lua filter (either a custom one that you write specifically to read the file and generate the content you want OR using the the |
Beta Was this translation helpful? Give feedback.
-
Hi @astrowonk what are your constraints? For what you described, I'm moving my documents to use Observable. Consider the following minimal working example:
When you render the |
Beta Was this translation helpful? Give feedback.
Hi @astrowonk what are your constraints?
For what you described, I'm moving my documents to use Observable. Consider the following minimal working example:
When you render the
.qmd
or.ipynb
with Quarto, it will process the Python cells and by using theojs_define
you will export the value of the variable to Observable. When you open the HTML file, Observable will replace the${my_output}
with the value exported.