How to add new line in Markdown presentation?

会有一股神秘感。 提交于 2019-12-03 04:05:52

问题


How to add new line in Markdown presentation?
I mean, something like

\newline

in tex.


回答1:


See the original markdown specification (bold mine):

The implication of the “one or more consecutive lines of text” rule is that Markdown supports “hard-wrapped” text paragraphs. This differs significantly from most other text-to-HTML formatters (including Movable Type’s “Convert Line Breaks” option) which translate every line break character in a paragraph into a <br /> tag.

When you do want to insert a <br /> break tag using Markdown, you end a line with two or more spaces, then type return.




回答2:


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.




回答3:


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. 



回答4:


Just add \ at the end of line. For example

one\
two

Will become

one
two

It's also better than two spaces because it's visible.




回答5:


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>



回答6:


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")


来源:https://stackoverflow.com/questions/33191744/how-to-add-new-line-in-markdown-presentation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!