From b2eebe34ad528c32bba37da6c92f7873cf9bfb6f Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Tue, 13 Nov 2018 10:15:42 +0100 Subject: [PATCH 1/2] Define text/latex printing of HorizontalRule with the latex function, fix #29995. --- stdlib/Markdown/src/render/latex.jl | 3 +++ stdlib/Markdown/test/runtests.jl | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/stdlib/Markdown/src/render/latex.jl b/stdlib/Markdown/src/render/latex.jl index 1e885a578d588..9a6ea41ead99c 100644 --- a/stdlib/Markdown/src/render/latex.jl +++ b/stdlib/Markdown/src/render/latex.jl @@ -101,6 +101,9 @@ function latex(io::IO, md::List) end function show(io::IO, ::MIME"text/latex", md::HorizontalRule) + latex(io, md) +end +function latex(io::IO, md::HorizontalRule) println(io, "\\rule{\\textwidth}{1pt}") end diff --git a/stdlib/Markdown/test/runtests.jl b/stdlib/Markdown/test/runtests.jl index e1d03fdffaffd..6c5f82278eddf 100644 --- a/stdlib/Markdown/test/runtests.jl +++ b/stdlib/Markdown/test/runtests.jl @@ -1108,3 +1108,9 @@ let @test v.content[5].loose @test !v.content[7].loose end + +# issue #29995 +let m = Markdown.parse("---"), io = IOBuffer() + show(io, "text/latex", m) + @test String(take!(io)) == "\\rule{\\textwidth}{1pt}\n" +end From 7d943cb864dbf9c66167dc4fb1beddf20df7bb70 Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Tue, 13 Nov 2018 10:17:43 +0100 Subject: [PATCH 2/2] Remove old show method for HorizontalRule. --- stdlib/Markdown/src/render/latex.jl | 3 --- 1 file changed, 3 deletions(-) diff --git a/stdlib/Markdown/src/render/latex.jl b/stdlib/Markdown/src/render/latex.jl index 9a6ea41ead99c..8182adba96039 100644 --- a/stdlib/Markdown/src/render/latex.jl +++ b/stdlib/Markdown/src/render/latex.jl @@ -100,9 +100,6 @@ function latex(io::IO, md::List) end end -function show(io::IO, ::MIME"text/latex", md::HorizontalRule) - latex(io, md) -end function latex(io::IO, md::HorizontalRule) println(io, "\\rule{\\textwidth}{1pt}") end