Skip to content

Commit 224f1e9

Browse files
tpappfredrikekre
authored andcommitted
Fix LaTeX output for markdown tables. (#25025)
The `\hline` was printed to `STDOUT`. Also added a test.
1 parent cffc6ac commit 224f1e9

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

base/markdown/GitHub/table.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ function latex(io::IO, md::Table)
161161
end
162162
println(io, " \\\\")
163163
if i == 1
164-
println("\\hline")
164+
println(io, "\\hline")
165165
end
166166
end
167167
end

test/markdown.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,14 @@ Some **bolded**
296296
- list2
297297
"""
298298
@test latex(book) == "\\section{Title}\nSome discussion\n\n\\begin{quote}\nA quote\n\n\\end{quote}\n\\subsection{Section \\emph{important}}\nSome \\textbf{bolded}\n\n\\begin{itemize}\n\\item list1\n\n\n\\item list2\n\n\\end{itemize}\n"
299+
table = md"""
300+
a | b
301+
---|---
302+
1 | 2
303+
"""
304+
@test latex(table) ==
305+
"\\begin{tabular}\n{r | r}\na & b \\\\\n\\hline\n1 & 2 \\\\\n\\end{tabular}\n"
306+
299307
# mime output
300308
let out =
301309
"""

0 commit comments

Comments
 (0)