diff --git a/base/markdown/Common/Common.jl b/base/markdown/Common/Common.jl index b98cb68d97cf7..23e849e12607b 100644 --- a/base/markdown/Common/Common.jl +++ b/base/markdown/Common/Common.jl @@ -2,4 +2,6 @@ include("block.jl") include("inline.jl") @flavor common [list, indentcode, blockquote, hashheader, paragraph, - escapes, en_dash, inline_code, asterisk_bold, asterisk_italic, image, link] + + linebreak, escapes, en_dash, inline_code, asterisk_bold, + asterisk_italic, image, link] diff --git a/base/markdown/Common/inline.jl b/base/markdown/Common/inline.jl index 492d62268bb1e..6b2a08c1c36de 100644 --- a/base/markdown/Common/inline.jl +++ b/base/markdown/Common/inline.jl @@ -78,6 +78,14 @@ end # Punctuation # ––––––––––– +type LineBreak end + +@trigger "\\\n" -> +function linebreak(stream::IO) + skip(stream, 2) + return LineBreak() +end + @trigger '-' -> function en_dash(stream::IO) if startswith(stream, "--") @@ -85,7 +93,7 @@ function en_dash(stream::IO) end end -const escape_chars = "\\`*_#+-.!{[(" +const escape_chars = "\\`*_#+-.!{[(\$" @trigger '\\' -> function escapes(stream::IO) diff --git a/base/markdown/GitHub/GitHub.jl b/base/markdown/GitHub/GitHub.jl index 56bd5ea6544b8..f8ac635431b11 100644 --- a/base/markdown/GitHub/GitHub.jl +++ b/base/markdown/GitHub/GitHub.jl @@ -36,4 +36,6 @@ end # TODO: tables @flavor github [list, indentcode, blockquote, fencedcode, hashheader, github_paragraph, - en_dash, inline_code, asterisk_bold, asterisk_italic, image, link] + + linebreak, escapes, en_dash, inline_code, asterisk_bold, asterisk_italic, + image, link] diff --git a/base/markdown/Julia/Julia.jl b/base/markdown/Julia/Julia.jl index 58153e84ab31f..20f89000836d4 100644 --- a/base/markdown/Julia/Julia.jl +++ b/base/markdown/Julia/Julia.jl @@ -10,5 +10,5 @@ include("interp.jl") @flavor julia [blocktex, blockinterp, hashheader, list, indentcode, fencedcode, blockquote, paragraph, - escapes, latex, interp, en_dash, inline_code, asterisk_bold, + linebreak, escapes, latex, interp, en_dash, inline_code, asterisk_bold, asterisk_italic, image, link] diff --git a/base/markdown/render/html.jl b/base/markdown/render/html.jl index 89f7616726af5..5301f207fa33c 100644 --- a/base/markdown/render/html.jl +++ b/base/markdown/render/html.jl @@ -98,6 +98,10 @@ function htmlinline(io::IO, link::Link) print(io,"""""") end +function htmlinline(io::IO, br::LineBreak) + print(io, "
") +end + htmlinline(io::IO, x) = tohtml(io, x) # API diff --git a/base/markdown/render/plain.jl b/base/markdown/render/plain.jl index c4fa555b709b7..630a80a09a94c 100644 --- a/base/markdown/render/plain.jl +++ b/base/markdown/render/plain.jl @@ -36,6 +36,10 @@ function plain(io::IO, list::List) end end +function plaininline(io::IO, br::LineBreak) + println(io) +end + plain(io::IO, x) = tohtml(io, x) # Inline elements diff --git a/base/markdown/render/terminal/render.jl b/base/markdown/render/terminal/render.jl index 63de8036f845b..ffff1b570791c 100644 --- a/base/markdown/render/terminal/render.jl +++ b/base/markdown/render/terminal/render.jl @@ -61,6 +61,10 @@ function term(io::IO, md::Code, columns) end end +function term(io::IO, br::LineBreak, columns) + println(io) +end + term(io::IO, x, _) = writemime(io, MIME"text/plain"(), x) # Inline Content