How to interpolate variable into markdown codeblock in Pluto.jl?

Viewed 59

In Pluto if I try to include an interpolated value in the markdown string, it renders the string without interpolating the value. enter image description here

I'd like the string to render as: My variable's value is: 10

1 Answers

Markdown itself isn't intended to interpolate variables. You may use Markdown.parse instead of md"" literal. This allows the string to interpolate the variables before passing to the Markdown parser.

Markdown.parse("""
My variable's value is: `$x`.
""")

enter image description here

Related