Is there any way to format an interpolated string as a literal such that it looks like code when displaying the Markdown string?
Some failed attempts:
julia> x = 5
5
julia> display(md"""Test: `$x`""")
Test: $x
julia> display(md"""Test: $(join(["`", x, "`"]))""") # doesn't render literal
Test: `5`
Interpolation into md
-strings doesn't work in all contexts, as you have noticed, but you can create the string first, and then Markdown.parse
it:
julia> using Markdown
julia> x = 5;
julia> Markdown.parse("""Test: `$x`""")
Test: 5
Thanks a lot! :smiling_face:
Adrian Hill has marked this topic as resolved.
Last updated: Nov 06 2024 at 04:40 UTC