Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Markdown Text Format

Markdown Text Format

Markdown paragraphs have no special format; just write the text directly,Line breaks in a paragraph are created by adding two or more spaces followed by a carriage return.

Of course, you can also use a blank line after a paragraph to indicate the start of a new paragraph.


Font

Text emphasis is an important technique in writing, and Markdown provides a concise way to achieve bold and italic effects.

Markdown can use the following font styles: bold and italic.

**Bold syntax:** Use two asterisks ** or two underscores __ to enclose text:

这是**粗体文字**使用星号

这是__粗体文字__使用下划线

**Italic syntax:** Use one asterisk * or one underscore _ to enclose text:

这是*斜体文字*使用星号

这是_斜体文字_使用下划线

**Bold-italic combination:** Use three asterisks *** or three underscores ___.

*斜体文本*

_斜体文本_

Bold text

__粗体文本__

Bold italic text

___粗斜体文本___

The display effect is as follows:

Mixed usage tips:

这段文字包含**粗体**、*斜体*和***粗斜体***的组合效果。

The rendering result is as follows:

Usage recommendation:


Horizontal rules

You can use three or more asterisks, hyphens, or underscores on a line to create a horizontal rule; nothing else may appear on that line. You can also insert spaces between the asterisks or hyphens. Each of the following forms can create a horizontal rule:

***



* * *



*****



- - -



----------

The display effect is as follows:


Strikethrough

To add strikethrough to text in a paragraph, simply add two tildes ~~ at both ends of the text. An example is shown below:

RUNOOB.COM

GOOGLE.COM

~~BAIDU.COM~~

The display effect is as follows:


Underline

Underline can be achieved using HTML's tag:

带下划线文本

The display effect is as follows:


Footnote

A footnote is a supplementary explanation of the text.

The Markdown footnote format is as follows:

[^要注明的文本]

The following example demonstrates the usage of footnotes:

创建脚注格式类似这样 [^RUNOOB]。



[^RUNOOB]: Runoob Tutorial -- 学的不仅是技术,更是梦想!!!

The demonstration effect is as follows:


Inline code markup

Inline code is used to mark code snippets, commands, variable names, etc. within the body text:

Basic Syntax:
Use a backtick to enclose code:



使用 `git commit` 命令提交代码

变量 `userName` 存储用户名

在终端中输入 `npm install` 安装依赖

Rendered effect:

**Code containing backticks:** When the code itself contains backticks, enclose it using two backticks.



要显示反引号,使用 `` `code` `` 这样的格式

Rendered effect:

Application scenarios:

  • API names and function names in technical documentation
  • Parameter names in configuration files
  • Command-line instructions
  • Keyboard shortcuts (such as Ctrl+C)

Text highlighting (extended syntax)

Text highlighting is not standard Markdown syntax, but many extensions support it:

Common syntax(supported on some platforms):

这是==高亮文本==

HTML alternative:

这是高亮文本


Paragraphs and line breaks

How to create paragraphs

In Markdown, a paragraph is the basic unit of text; understanding paragraph rules is essential for correctly formatting documents.

Basic paragraph rules:

  • A paragraph consists of one or more consecutive lines of text
  • Paragraphs are separated by one or more blank lines
  • Normal paragraphs should not be indented with spaces or tabs

Correct paragraph writing:



这是第一个段落。它可以包含多个句子,内容可以很长,会自动换行显示。



这是第二个段落。注意上面有一个空行分隔。



这是第三个段落。

Common mistakes:



这是第一段

这是第二段(错误:没有空行分隔)



    这是缩进段落(错误:不应该缩进)

Forced line break techniques

Sometimes you need to break a line without creating a new paragraph; Markdown provides several methods:

Method 1: Two spaces at the end of a line
Add two or more spaces at the end of a line, then press Enter:

第一行内容(这里有两个空格)  

第二行内容

Method 2: HTML line break tag

第一行内容
第二行内容

Method 3: Backslash (supported by some parsers)

第一行内容\

第二行内容

Practical Application Examples:

地址:北京市朝阳区  

电话:010-12345678  

邮箱:admin@runoob.com



Poetry example:

床前明月光,  

疑是地上霜。  

举头望明月,  

低头思故乡。

The role of blank lines

Blank lines play an important role in Markdown:

Separate paragraphs:

第一段内容



第二段内容

Separate different elements:



# 标题



段落内容



- 列表项1

- 列表项2



另一段内容

Best Practice Recommendations:

  • Leave a blank line between the heading and the content
  • Leave blank lines before and after lists
  • Leave blank lines before and after code blocks
  • Maintain consistent use of blank lines