Skip to content

Commit 458056c

Browse files
committed
Revert "fix markdown rendering (#37235)"
This reverts commit 36505aa.
1 parent 18c759f commit 458056c

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ end
99
words(s) = split(s, " ")
1010
lines(s) = split(s, "\n")
1111

12-
function _wrapped_lines(s::AbstractString, width, i)
12+
function wrapped_lines!(lines, io::IO, s::AbstractString, width, i)
1313
ws = words(s)
14-
lines = String[]
1514
for word in ws
1615
word_length = ansi_length(word)
1716
if i + word_length + 1 > width
@@ -26,14 +25,17 @@ function _wrapped_lines(s::AbstractString, width, i)
2625
end
2726
end
2827
end
29-
return i, lines
28+
return i
3029
end
3130

3231
function wrapped_lines(io::IO, s::AbstractString; width = 80, i = 0)
33-
lines = String[]
34-
for ss in split(s, "\n")
35-
i, line = _wrapped_lines(ss, width, i)
36-
append!(lines, line)
32+
lines = AbstractString[]
33+
if occursin(r"\n", s)
34+
for ss in split(s, "\n")
35+
i = wrapped_lines!(lines, io, ss, width, i)
36+
end
37+
else
38+
wrapped_lines!(lines, io, s, width, i)
3739
end
3840
return lines
3941
end

stdlib/Markdown/test/runtests.jl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,11 +1171,3 @@ end
11711171
| $x |
11721172
""")
11731173
end
1174-
1175-
@testset "issue #37232: linebreaks" begin
1176-
s = @md_str """
1177-
Misc:\\
1178-
- line\\
1179-
"""
1180-
@test sprint(show, MIME("text/plain"), s) == " Misc:\n - line\n "
1181-
end

0 commit comments

Comments
 (0)