正在加载…

  欢迎来到克喵的博客!这里记录了我生活日常、资源分享和踩坑教程,希望你能喜欢!
Post cover image

Markdown 段落语法

2025年6月28日 • 技术分享

489 字-

原文链接: 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>

This is the first line.
And this is the second line.

换行(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.
在转载或引用本文时,请务必遵守许可协议并注明来源

给我打钱,助力晓雨成为虚拟主播(划掉

评论
  • 按正序
  • 按倒序
  • 按热度
Powered by Waline v3.4.1
克喵爱吃卤面's Avatar

克喵爱吃卤面

每一段旅行都有终点~

近期文章
云存储提供商
友情链接