# Line breaks in Markdown

**URL:** <https://discourse.julialang.org/t/line-breaks-in-markdown/17473>\
**Category:** General Usage\
**Tags:** markdown\
**Created:** [November 13, 2018, 2:20pm UTC](https://discourse.julialang.org/t/line-breaks-in-markdown/17473 "2018-11-13T14:20:30Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [November 13, 2018, 2:20pm UTC](https://discourse.julialang.org/t/line-breaks-in-markdown/17473/1 "2018-11-13T14:20:30Z")

</div>

I am trying to port some documentation from RST to Markdown and can’t figure how to make a line break without creating a new paragraph. As an example see this RST based [doc](https://gmt.soest.hawaii.edu/doc/latest/solar.html#c) and compare to the [markdown version](https://genericmappingtools.github.io/GMT.jl/latest/solar/) created with `Documenter`. I know I can introduce a paragraph (and so far it’s my only choice) but shouldn’t it be possible to do line breaks in Julia’s Markdown? I tried inserting two spaces before the line break like I see in web docs, but no effect. In fact, even I try in REPL I can not do it as well

```julia
julia> d1 = md"""- *C*
                   blabla"""
    • C

  blabla

```

---

<div class="post-metadata">

**Author:** ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Post date:** [November 15, 2018, 11:57am UTC](https://discourse.julialang.org/t/line-breaks-in-markdown/17473/2 "2018-11-15T11:57:18Z")

</div>

Two spaces before the line break is standard markdown syntax - if that doesn’t work with Documenter it might be worth opening an issue.

---

<div class="post-metadata">

**Author:** ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)\
**Post date:** [November 15, 2018, 12:25pm UTC](https://discourse.julialang.org/t/line-breaks-in-markdown/17473/3 "2018-11-15T12:25:15Z")

</div>

This works:

```julia
julia> display(md"""adfa\
       sdfads
       """)
  adfa
  sdfads

```

Note that the two spaces wouldn’t really work in the current Julia setup as trailing white-space is not allowed.

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [November 15, 2018, 2:19pm UTC](https://discourse.julialang.org/t/line-breaks-in-markdown/17473/4 "2018-11-15T14:19:32Z")

</div>

My REPL example was an attempt to show a very simple to reproduce example. When you say `wouldn’t really work in the current Julia setup as trailing white-space is not allowed` you mean the REPL only or in .md files too?

As I mentined, I was not able to make it work in .md files processed with `Documenter.jl` but I can see it work in the Julia manual [here](https://docs.julialang.org/en/v1/manual/documentation/#Paragraphs-1)  
so I’m confused.

---

<div class="post-metadata">

**Author:** ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)\
**Post date:** [November 15, 2018, 2:39pm UTC](https://discourse.julialang.org/t/line-breaks-in-markdown/17473/5 "2018-11-15T14:39:05Z")

</div>

> [@mauro3](#):
>
> Note that the two spaces wouldn’t really work in the current Julia setup as trailing white-space is not allowed.

What I meant is that the test-suite of Julia itself currently fails when there is trailing white-space. Of course this could be changed, but people seem reasonably fond of it.

---

<div class="post-metadata">

**Author:** ![oxinabox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oxinabox/32/206603_2.png) [@oxinabox](https://discourse.julialang.org/u/oxinabox)\
**Post date:** [November 19, 2018, 12:21pm UTC](https://discourse.julialang.org/t/line-breaks-in-markdown/17473/6 "2018-11-19T12:21:22Z")

</div>

CommonMark spec says line break from ending with two spaces then a new line.  
Propergating new Markdown varients causes sufferring.

Let’s not, not use the CommonMark spec.

> A line break (not in a code span or HTML tag) that is preceded by two or more spaces and does not occur at the end of a block is parsed as a hard line break (rendered in HTML as a   
> tag):

[https://spec.commonmark.org/0.28/#hard-line-break](https://spec.commonmark.org/0.28/#hard-line-break)

---

<div class="post-metadata">

**Author:** ![swissr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/swissr/32/208_2.png) [@swissr](https://discourse.julialang.org/u/swissr)\
**Post date:** [November 19, 2018, 1:35pm UTC](https://discourse.julialang.org/t/line-breaks-in-markdown/17473/7 "2018-11-19T13:35:34Z")

</div>

CommonMark (your link) mentions that a slash can be used for hard line breaks:

> For a more visible alternative, a backslash before the line ending may be used instead of two spaces

Maybe this `\` should be added under the ‘[the following markdown syntax is supported in Julia](https://docs.julialang.org/en/v1/manual/documentation/#Markdown-syntax-1)’ chapter in the manual? And mention that `.. `, i.e. 2+ spaces, are not supported (if the reasonable trailing white-space behavior stays as is).

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [November 19, 2018, 1:48pm UTC](https://discourse.julialang.org/t/line-breaks-in-markdown/17473/8 "2018-11-19T13:48:35Z")

</div>

Thanks for the link @kevbonham. Indeed the `\` works fine from within the `Documenter.jl`

---

<div class="post-metadata">

**Author:** ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Post date:** [November 19, 2018, 2:04pm UTC](https://discourse.julialang.org/t/line-breaks-in-markdown/17473/9 "2018-11-19T14:04:13Z")

</div>

I think you meant to thank @swissr? Though I am half Swiss and willing to take credit on my countryman’s behalf 😄

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [November 19, 2018, 2:06pm UTC](https://discourse.julialang.org/t/line-breaks-in-markdown/17473/10 "2018-11-19T14:06:53Z")

</div>

Sure, thank you both (I actually had seen it too from the link but @swissr post made me tried it right away) .

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [November 19, 2018, 2:24pm UTC](https://discourse.julialang.org/t/line-breaks-in-markdown/17473/11 "2018-11-19T14:24:24Z")

</div>

And to be fair @mauro3 was the first to touch the point.
