温馨提醒
这篇文章发布于 117 天前,内容可能已过时,请谨慎参考。
type
status
date
slug
summary
tags
category
icon
password
原文链接: https://markdown.com.cn/basic-syntax/line-breaks.html
Markdown 换行语法
在一行的末尾添加两个或多个空格,然后按回车键,即可创建一个换行(
<br>)。Markdown语法 | HTML | 预览效果 |
This is the first line. And this is the second line. | <p>This is the first line.<br>And this is the second line.</p> | ㅤ |
换行(Line Break)用法的最佳实践
几乎每个 Markdown 应用程序都支持两个或多个空格进行换行,称为
结尾空格(trailing whitespace) 的方式,但这是有争议的,因为很难在编辑器中直接看到空格,并且很多人在每个句子后面都会有意或无意地添加两个空格。由于这个原因,你可能要使用除结尾空格以外的其它方式来换行。幸运的是,几乎每个 Markdown 应用程序都支持另一种换行方式:HTML 的 <br> 标签。为了兼容性,请在行尾添加“结尾空格”或 HTML 的
<br> 标签来实现换行。还有两种其他方式我并不推荐使用。CommonMark 和其它几种轻量级标记语言支持在行尾添加反斜杠 (
\) 的方式实现换行,但是并非所有 Markdown 应用程序都支持此种方式,因此从兼容性的角度来看,不推荐使用。并且至少有两种轻量级标记语言支持无须在行尾添加任何内容,只须键入回车键(return)即可实现换行。✅ Do this | ❌ Don’t do this |
First line with two spaces after. And the next line. | First line with a backslash after.\ And the next line. |
First line with the HTML tag after.<br> And the next line. | First line with nothing after. And the next line. |
- 作者:克喵爱吃卤面
- 链接:http://preview.tangly1024.com/article/markdown-huanhang
- 声明:本文采用 CC BY-NC-SA 4.0 许可协议,转载请注明出处。









