From 7fac5cb1d0a702374d4db584a86457497a469952 Mon Sep 17 00:00:00 2001 From: Matt Bauman Date: Thu, 10 Sep 2015 16:55:39 -0400 Subject: [PATCH] Teach Markdown how to output inline LaTeX to RST --- base/markdown/render/rst.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/base/markdown/render/rst.jl b/base/markdown/render/rst.jl index e9439f43f80eb..1651d2778a066 100644 --- a/base/markdown/render/rst.jl +++ b/base/markdown/render/rst.jl @@ -73,7 +73,7 @@ function rstinline(io::IO, md...) wasCode = false for el in md wasCode && isa(el, AbstractString) && !Base.startswith(el, " ") && print(io, "\\ ") - wasCode = isa(el, Code) && (wasCode = true) + wasCode = (isa(el, Code) || isa(el, LaTeX)) && (wasCode = true) rstinline(io, el) end end @@ -96,6 +96,8 @@ rstinline(io::IO, md::Code) = print(io, "``", md.code, "``") rstinline(io::IO, br::LineBreak) = println(io) +rstinline(io::IO, l::LaTeX) = print(io, ":math:`", l.formula, "`") + rstinline(io::IO, x) = writemime(io, MIME"text/rst"(), x) # writemime