这里写自定义目录标题
欢迎使用Markdown编辑器
官方markdown在线编译器
菜鸟markdown在线编译器
前言
你好! 这是你第一次使用 Markdown编辑器 所展示的欢迎页。如果你想学习如何使用Markdown编辑器, 可以仔细阅读这篇文章,了解一下Markdown的基本语法知识。
Markdown是一种轻量级标记语言,排版语法简洁,让人们更多地关注内容本身而非排版。它使用易读易写的纯文本格式编写文档,可与HTML混编,可导出 HTML、PDF 以及本身的 .md 格式的文件。因简洁、高效、易读、易写,Markdown被大量使用,如Github、Wikipedia、简书等。
在线体验一下 Markdown在线编辑器。
官方markdown在线编译器
菜鸟markdown在线编译器
千万不要被「标记」、「语言」吓到,Markdown的语法十分简单,常用的标记符号不超过十个,用于日常写作记录绰绰有余,不到半小时就能完全掌握。
就是这十个不到的标记符号,却能让人优雅地沉浸式记录,专注内容而不是纠结排版,达到「心中无尘,码字入神」的境界。
让我们从 Markdown 标题语法开始学习吧。
基本语法
要创建标题,请在单词或短语前面添加井号 (#) 。# 的数量代表了标题的级别。例如,添加三个 # 表示创建一个三级标题 (<h3>)
(例如:### My Header)。
Markdown语法 | HTML | 预览效果 |
---|---|---|
# Heading level 1 | <h1>Heading level 1</h1> | Heading level 1 |
## Heading level 2 | <h2>Heading level 1</h2> | Heading level 2 |
### Heading level 3 | <h3>Heading level 1</h3> | Heading level 3 |
#### Heading level 4 | <h4>Heading level 1</h4> | Heading level 4 |
##### Heading level 5 | <h5>Heading level 1</h5> | Heading level 5 |
###### Heading level 6 | <h6>Heading level 1</h6> | Heading level 6 |
注:这里显示的预览效果发挥不出来无法调整字体大小,
预览效果是一级标签到六级标签字体依次从大到小的字体
可选语法
还可以在文本下方添加任意数量的 == 号来标识一级标题,或者 – 号来标识二级标题。
Markdown语法 | HTML | 预览效果 |
---|---|---|
Heading level 1 =============== | <h1>Heading level 1</h1> | Heading level 1 |
Heading level 2 --------------- | <h2>Heading level 2</h2> | Heading level 2 |
最佳实践
不同的 Markdown 应用程序处理 #
和标题之间的空格方式并不一致。为了兼容考虑,请用一个空格在 #
和标题之间进行分隔。
✅ Do this | ❌ Don’t do this |
---|---|
# Here's a Heading | #Here's a Heading |
Markdown 段落语法
要创建段落,请使用空白行将一行或多行文本进行分隔。
Markdown语法 | HTML | 预览效果 |
---|---|---|
I really like using Markdown. I think I'll use it to format all of my documents from now on. | <p>I really like using Markdown.</p> <p>I think I'll use it to format all of my documents from now on.</p> | I really like using Markdown. I think I’ll use it to format all of my documents from now on. |
段落(Paragraph)用法的最佳实
不要用空格(spaces)或制表符( tabs)缩进段落。
✅ Do this | ❌ Don’t do this |
---|---|
Don't put tabs or spaces in front of your paragraphs. Keep lines left-aligned like this. | This can result in unexpected formatting problems. Don't add tabs or spaces in front of paragraphs. |
Markdown 换行语法
在一行的末尾添加两个或多个空格,然后按回车键,即可创建一个换行(<br>
)。
Markdown语法 | HTML | 预览效果 |
---|---|---|
This is the first line. And this is the second line. | This is the first line. | 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 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. |
Markdown 强调语法
通过将文本设置为粗体或斜体来强调其重要性。
粗体(Bold)
要加粗文本,请在单词或短语的前后各添加两个星号(asterisks)或下划线(underscores)。如需加粗一个单词或短语的中间部分用以表示强调的话,请在要加粗部分的两侧各添加两个星号(asterisks)。
Markdown语法 | HTML | 预览效果 |
---|---|---|
I just love **bold text**. | I just love <strong>bold text</strong>. | I just love bold text. |
I just love __bold text__. | I just love <strong>bold text</strong>. | I just love bold text. |
Love**is**bold | Love<strong>is</strong>bold | Loveisbold |
粗体(Bold)用法最佳实践
Markdown 应用程序在如何处理单词或短语中间的下划线上并不一致。为兼容考虑,在单词或短语中间部分加粗的话,请使用星号(asterisks)。
✅ Do this | ❌ Don’t do this |
---|---|
Loveisbold | Love__is__bold |
斜体(Italic)
要用斜体显示文本,请在单词或短语前后添加一个星号(asterisk)或下划线(underscore)。要斜体突出单词的中间部分,请在字母前后各添加一个星号,中间不要带空格。
Markdown语法 | HTML | 预览效果 |
---|---|---|
Italicized text is the cat’s meow. | Italicized text is the cat’s meow. | Italicized text is the cat’s meow. |
Italicized text is the cat’s meow. | Italicized text is the cat’s meow. | Italicized text is the cat’s meow. |
Acatmeow | Acatmeow | Acatmeow |
斜体(Italic)用法的最佳实践
要同时用粗体和斜体突出显示文本,请在单词或短语的前后各添加三个星号或下划线。要加粗并用斜体显示单词或短语的中间部分,请在要突出显示的部分前后各添加三个星号,中间不要带空格。
✅ Do this | ❌ Don’t do this |
---|---|
Acatmeow | A_cat_meow |
粗体(Bold)和斜体(Italic)
要同时用粗体和斜体突出显示文本,请在单词或短语的前后各添加三个星号或下划线。要加粗并用斜体显示单词或短语的中间部分,请在要突出显示的部分前后各添加三个星号,中间不要带空格。
Markdown语法 | HTML | 预览效果 |
---|---|---|
This text is really important. | This text is really important. | This text is really important. |
This text is really important. | This text is really important. | This text is really important. |
This text is really important. | This text is really important. | This text is really important. |
This text is really important. | This text is really important. | This text is really important. |
This is really very important text. | This is reallyveryimportant text. | This is reallyveryimportant text. |
粗体(Bold)和斜体(Italic)用法的最佳
Markdown 应用程序在处理单词或短语中间添加的下划线上并不一致。为了实现兼容性,请使用星号将单词或短语的中间部分加粗并以斜体显示,以示重要。
✅ Do this | ❌ Don’t do this |
---|---|
This is really***very***important text. | This is really___very___important text. |
未完待续……
敬请期待