如何在Markdown演示文稿中添加新行?

时间:2015-10-17 21:24:16

标签: markdown r-markdown presentation

如何在Markdown演示中添加新行?
我的意思是,像

  

\换行符

tex 中的

12 个答案:

答案 0 :(得分:72)

the original markdown specification(大胆的我的):

  

“一个或多个连续文本行”规则的含义是Markdown支持“硬包装”文本段落。这与大多数其他文本到HTML格式化程序(包括Movable Type的“转换换行符”选项)显着不同,后者将段落中的每个换行符转换为<br />标记。

     

如果您想使用Markdown插入<br />中断标记,则结束包含两个或多个空格的行,然后键入return。

答案 1 :(得分:45)

  

如何在Markdown演示文稿中添加新行?

检查以下资源Line Return

  

要强制换行,请在一行的末尾放置两个空格。

答案 2 :(得分:16)

MarkDown文件以三种方式换行

<br /> 标记使用

paragraph First Line <br /> Second Line

\ 使用

First Line sentence \
Second Line sentence 

space keypress two times 使用

First Line sentence␠␠
Second Line sentence

正在使用的段落 <br /> 标记。

使用 \ 的多个句子或两次按 space key ,然后按Enter并写一个新句子。

答案 3 :(得分:12)

您可以在R markdown中使用&nbsp;来创建新的空白行。

例如,在.Rmd文件中:

I want 3 new lines: 

&nbsp;
&nbsp;
&nbsp;

End of file. 

答案 4 :(得分:12)

只需在行尾添加\。例如

one\
two

将成为

one
two

因为它是可见的,所以它也比两个空格要好。

答案 5 :(得分:3)

如果这里没有提到任何解决方案对我有用,那么您可以执行以下操作: 添加一个空标题(破坏语义的黑客程序)

    fields: FormlyFieldConfig[] = [
    { 
      key: 'Autocomplete',
      type: 'autocomplete',
      templateOptions: {
      required: true,
      label: 'Autocomplete',
      placeholder: 'Placeholder',
      filter: (term) => of(term ? this.filterStates(term) : states.slice()),
      onValueSelect: (field, $event) => { //call the onSelect event 
      console.log('----->select event called')
    }
  },
   
  
   
},`

只需确保添加标头后,markdown css中标头的底部没有边框,因此您可以尝试使用标头的不同变体。

答案 6 :(得分:3)

什么对我有用

\
&nbsp;
\
&nbsp;

enter image description here

答案 7 :(得分:2)

这取决于您使用哪种降价解析器。例如,在showdownjs中,有一个选项{simpleLineBreaks: true}为以下md输入提供相应的html:

a line
wrapped in two
<p>a line<br>
wrapped in two</p>

答案 8 :(得分:0)

我在Android中使用Markwon进行降价解析。以下效果很好:

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

...每行末尾有两个空格,后跟\n

答案 9 :(得分:0)

我想创建一个MarkdownPreviewer作为freecodecamp中项目的一部分进行响应。所以我拼命地寻找换行字符来减价。经过许多建议。 我终于使用了\ n并成功了。

答案 10 :(得分:0)

使用

##

就是这样,它会显示一个简单的线条

答案 11 :(得分:-2)

换行符(\ n)可用于以编程方式将换行符添加到markdown文件中。例如,可以在python中这样做:

with open("file_name.md", "w") as file:
   file.write("Some text")
   file.write("\n")
   file.write("Some other text")