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> | This is the first line. And this is the second line. |
换行(Line Break)用法的最佳实践
几乎每个 Markdown 应用程序都支持通过在行尾添加两个或多个空格(称为“结尾空格”)来实现换行。但这种方式存在争议,因为空格在编辑器中通常是不可见的。
因此,为了更好的兼容性和可读性,我们推荐使用 HTML 的 <br>
标签来创建换行。
另外一些方式,如在行尾添加反斜杠 (\\
) 或直接按回车,并非所有 Markdown 应用都支持,因此不建议在需要广泛兼容的文档中使用。
✅ Do this | ❌ Don't do this |
---|---|
First line with two spaces after.
And the next line.
First line with the HTML tag after.<br>
And the next line. | First line with a backslash after.\
And the next line.
First line with nothing after.
And the next line. |