How to add new line in Markdown presentation?

前端 未结 10 1266
旧巷少年郎
旧巷少年郎 2020-12-07 12:41

How to add new line in Markdown presentation?

I mean, something like \\newline in TeX.

相关标签:
10条回答
  • 2020-12-07 13:13

    It depends on what kind of markdown parser you're using. For example in showdownjs there is an option {simpleLineBreaks: true} which gives corresponding html for the following md input:

    a line
    wrapped in two
    
    <p>a line<br>
    wrapped in two</p>
    
    0 讨论(0)
  • 2020-12-07 13:22

    I wanted to create a MarkdownPreviewer in react as part of a project in freecodecamp. So I was desperately searching for newline characters for markdown. After trying many suggestions. I finally used \n and it worked.

    0 讨论(0)
  • 2020-12-07 13:23

    The newline character (\n) can be used to add a newline into a markdown file programmatically. For example, it is possible to do like this in python:

    with open("file_name.md", "w") as file:
       file.write("Some text")
       file.write("\n")
       file.write("Some other text")
    
    0 讨论(0)
  • 2020-12-07 13:24

    I was using Markwon for markdown parsing in Android. The following worked great:

    "My first line  \nMy second line  \nMy third line  \nMy last line"
    

    ...two spaces followed by \n at the end of each line.

    0 讨论(0)
  • 2020-12-07 13:28

    How to add new line in Markdown presentation?

    Check the following resource Line Return

    To force a line return, place two empty spaces at the end of a line.

    0 讨论(0)
  • 2020-12-07 13:33

    You could use &nbsp; in R markdown to create a new blank line.

    For example, in your .Rmd file:

    I want 3 new lines: 
    
    &nbsp;
    &nbsp;
    &nbsp;
    
    End of file. 
    
    0 讨论(0)
提交回复
热议问题