diff --git a/stdlib/Markdown/src/GitHub/table.jl b/stdlib/Markdown/src/GitHub/table.jl index 8e835ac59fc13b..08a375cca2fb8e 100644 --- a/stdlib/Markdown/src/GitHub/table.jl +++ b/stdlib/Markdown/src/GitHub/table.jl @@ -65,8 +65,10 @@ function html(io::IO, md::Table) withtag(io, :table) do for (i, row) in enumerate(md.rows) withtag(io, :tr) do - for c in md.rows[i] - withtag(io, i == 1 ? :th : :td) do + for (j, c) in enumerate(md.rows[i]) + alignment = md.align[j] + alignment = alignment === :l ? "left" : alignment === :r ? "right" : "center" + withtag(io, i == 1 ? :th : :td, ("align", alignment)) do htmlinline(io, c) end end diff --git a/stdlib/Markdown/test/runtests.jl b/stdlib/Markdown/test/runtests.jl index 251ad4cc4bd45d..47c977682ffc87 100644 --- a/stdlib/Markdown/test/runtests.jl +++ b/stdlib/Markdown/test/runtests.jl @@ -510,6 +510,7 @@ let text = """, table = Markdown.parse(text) @test text == Markdown.plain(table) + @test Markdown.html(table) == """
MarkdownTableTest
foobarbaz
barbazfoo
\n""" end let text = """ @@ -519,6 +520,7 @@ let text = """, table = Markdown.parse(text) @test text == Markdown.plain(table) + @test Markdown.html(table) == """
ab
x | y2
\n""" end # LaTeX extension