Skip to content

Commit be35825

Browse files
barucdenKristofferC
authored andcommitted
Markdown: fix string interpolation (#59806)
(cherry picked from commit 20c787d)
1 parent 649a5c8 commit be35825

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

stdlib/Markdown/src/Julia/interp.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ toexpr(x) = x
4646
toexpr(xs::Union{Vector{Any},Vector{Vector{Any}}}) =
4747
Expr(:call, GlobalRef(Base,:getindex), Any, mapany(toexpr, xs)...)
4848

49-
for T in Any[MD, Paragraph, Header, Link, Bold, Italic]
49+
for T in Any[MD, Paragraph, Header, Link, Bold, Italic, Footnote, Admonition]
5050
@eval function toexpr(md::$T)
5151
Expr(:call, typeof(md), $(map(x->:(toexpr(md.$x)), fieldnames(Base.unwrap_unionall(T)))...))
5252
end

stdlib/Markdown/test/runtests.jl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,30 @@ sum_ref = md"Behaves like $(ref(sum))"
502502
@test plain(sum_ref) == "Behaves like sum (see Julia docs)\n"
503503
@test html(sum_ref) == "<p>Behaves like sum &#40;see Julia docs&#41;</p>\n"
504504

505+
# JuliaLang/julia#59783
506+
let x = 1,
507+
result = md"""
508+
$x
509+
510+
[^1]: $x
511+
512+
!!! note
513+
$x
514+
""",
515+
expected = """
516+
1
517+
518+
[^1]: 1
519+
520+
!!! note
521+
522+
523+
524+
1
525+
"""
526+
@test plain(result) == expected
527+
end
528+
505529
show(io::IO, m::MIME"text/html", r::Reference) =
506530
Markdown.withtag(io, :a, :href=>"test") do
507531
Markdown.htmlesc(io, Markdown.plaininline(r))

0 commit comments

Comments
 (0)