Open
Description
Hi, I'm encountering the following issue when trying to interpolate a variable with a _ in name in Markdown strings
julia> using Markdown
julia> x_min = 2
2
julia> md"x_min=$x_min"
ERROR: UndefVarError: x not defined
Stacktrace:
[1] top-level scope
@ REPL[3]:1
julia> md"x_min=$(x_min)"
ERROR: syntax: invalid syntax (incomplete #<julia: "incomplete: premature end of input">)
Stacktrace:
[1] top-level scope
@ REPL[4]:1
I've seen this in 1.6 and also 1.7
julia> versioninfo()
Julia Version 1.7.0
Commit 3bf9d17731 (2021-11-30 12:12 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: AMD Ryzen 7 5800H with Radeon Graphics
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-12.0.1 (ORCJIT, znver3)
When I asked about this in slack, @jvaverka noted that
md"``x\_{min}=``$(x_min)"
can be used as a workaround and @KristofferC mentioned using the constructor directly instead of the string macro.
cc @toma-vlad
Activity
ForceBru commentedon Jan 5, 2023
Still present in Julia 1.8.2 and 1.9.0-beta2.