Markdown paragraphs have no special formatting; just write the text directly. To create a line break within a paragraph, use two or more spaces followed by a newline.
Alternatively, you can use a blank line after a paragraph to indicate the start of a new paragraph.
Fonts
Text emphasis is an important technique in writing. Markdown provides a concise way to achieve bold and italic effects.
Markdown supports the following font styles: bold and italic.
Bold Syntax: Surround the text with two asterisks ** or two underscores __:
This is bold text using asterisks. This is __bold text__ using underscores.
Italic Syntax: Surround the text with one asterisk * or one underscore _:
This is italic text using asterisks. This is _italic text_ using underscores.
Bold and Italic Combination: Use three asterisks *** or three underscores ___.
Italic text _italic text_ Bold text __bold text__ Bold and italic text ___bold and italic text___
The display effect is as follows:
Mixed Usage Tips:
This text contains a combination of bold, italic, and bold and italic effects.
The rendered effect is as follows:
Usage Recommendations:
- It is recommended to use asterisks
*instead of underscores_, as asterisks have better compatibility across various Markdown parsers. - Do not overuse emphasis; highlighting key points is more effective.
- When mixing Chinese and English, it is advisable to add spaces before and after emphasis symbols to improve readability.
Horizontal Rules
You can create a horizontal rule by using three or more asterisks, hyphens, or underscores on a line by themselves. There should be no other content on the line. You can also insert spaces between the asterisks or hyphens. Each of the following examples will create a horizontal rule:
*** * * * ***** - - - -----------
The display effect is as follows:
Strikethrough
To add strikethrough to text in a paragraph, simply surround the text with two tildes ~~. Here is an example:
GOOGLE.COM ~~BAIDU.COM~~
The display effect is as follows:
Underline
Underlines can be achieved using the HTML <u> tag:
Underlined text
The display effect is as follows:
Footnotes
Footnotes are supplementary notes to the text.
The format for Markdown footnotes is as follows:
[^Text to be noted]
The following example demonstrates the use of footnotes:
Create a footnote format like this [^]. [^]: -- Learning not just technology, but dreams!!!
The demonstration effect is as follows:
Inline Code
Inline code is used to mark code snippets, commands, variable names, etc., within the body text:
Basic Syntax:
Surround the code with a single backtick `:
Use the git commit command to submit code. The variable userName stores the username. Enter npm install in the terminal to install dependencies.
Rendered effect:
Code Containing Backticks: When the code itself contains backticks, surround it with two backticks.
To display a backtick, use the format `` `code` ``.
Rendered effect:
Application Scenarios:
- API names, function names in technical documentation.
- Parameter names in configuration files.
- Command-line instructions.
- Keyboard shortcuts (e.g.,
Ctrl+C).
Text Highlighting (Extended Syntax)
Text highlighting is not standard Markdown syntax, but many extensions support it:
Common Syntax (supported on some platforms):
This is ==highlighted text==
HTML Alternative:
This is highlighted text
Paragraphs and Line Breaks
Creating Paragraphs
In Markdown, paragraphs are the basic units of text. Understanding paragraph rules is crucial 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:
This is the first paragraph. It can contain multiple sentences, the content can be long, and it will wrap automatically. This is the second paragraph. Note the blank line separating them. This is the third paragraph.
Common Mistakes:
This is the first paragraphThis is the second paragraph (Error: no blank line separation) This is an indented paragraph (Error: should not be indented)
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:
First line content (here are two spaces) Second line content
Method 2: HTML Line Break Tag
First line content
Second line content
Method 3: Backslash (supported by some parsers)
First line content Second line content
Practical Application Examples:
Address: Chaoyang District, Beijing Phone: 010-12345678 Email: admin@
Poetry example: Bright moonlight before my bed, I suspect it is frost on the ground. I raise my head to gaze at the moon, then lower it, thinking of my hometown.
The Role of Blank Lines
Blank lines play an important role in Markdown:
Separating Paragraphs:
First paragraph content Second paragraph content
Separating Different Elements:
# Heading Paragraph content - List item 1 - List item 2 Another paragraph content
Best Practice Recommendations:
- Leave a blank line between headings and content.
- Leave a blank line before and after lists.
- Leave a blank line before and after code blocks.
- Maintain a consistent habit of using blank lines.
YouTip