2

I want to access a python parameter inside a standard Markdown paragraph. Think dynamically updated values in a text report. I don't want to do an f-string inside a code block outside the paragraph.

E.g. "... After [code1] years, we found [code2] instances of XYZ occurrences..."

A more detailed example of the expected behavior is in this RMarkdown Documentation.

I tried the RMarkdown syntax `python var_name` where var_name is a float and variations on that syntax with no success. Quarto is treating it like a code-formatted text block (not evaluating the code).

How do I do this in a Quarto .qmd file running the Jupyter Kernel in VS Code?

Edit:

Partial workarounds here (what I'm using now) and here. The first option requires string formatting for rounded floats, because float formatting leaves trailing zeros for some reason. I couldn't find documentation to make the second option more extendible.

  • 1
    See [Inline Code](https://quarto.org/docs/computations/execution-options.html#inline-code) from Quarto Doc. What you want is not exactly possible in the case of python, since Jupyter, Knitr, and Julia each of them has its own way (i.e. syntax) to evaluate inline code – shafee Nov 18 '22 at 12:19

0 Answers0