Skip to content

Commit 45b1b15

Browse files
anaveragehumanKristofferC
authored andcommitted
Markdown: prevent display() error with empty list item (#40122)
(cherry picked from commit cc639ec)
1 parent 60e70d8 commit 45b1b15

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

stdlib/Markdown/src/render/terminal/formatting.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ wrapped_lines(io::IO, f::Function, args...; width = 80, i = 0) =
4242

4343
function print_wrapped(io::IO, s...; width = 80, pre = "", i = 0)
4444
lines = wrapped_lines(io, s..., width = width, i = i)
45+
isempty(lines) && return 0, 0
4546
print(io, lines[1])
4647
for line in lines[2:end]
4748
print(io, '\n', pre, line)

stdlib/Markdown/test/runtests.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,3 +1213,12 @@ end
12131213
| $x |
12141214
""")
12151215
end
1216+
1217+
@testset "issue 40080: empty list item breaks display()" begin
1218+
d = TextDisplay(devnull)
1219+
display(d, md"""
1220+
1. hello
1221+
2.
1222+
""")
1223+
end
1224+

0 commit comments

Comments
 (0)