Markdown Text Formatting
Markdown provides various text formatting options to help you emphasize key points and highlight content. This chapter will detail various text formatting methods.
Bold
Basic Syntax
Use ** or __ to surround text:
**This is bold text**
__This is also bold text__Effect: This is bold text
Use Cases
- Emphasize important content
- Highlight keywords
- Mark term definitions
**Note:** This is an important tip.
**Key Concept:** Markdown is a markup language.Best Practices
✅ Recommended
This is **important** content.
❌ Not Recommended (no spaces may not be recognized)
This is**important**content.Italic
Basic Syntax
Use * or _ to surround text:
*This is italic text*
_This is also italic text_Effect: This is italic text
Use Cases
- Reference book and article titles
- Emphasize a particular word
- Foreign terms
I am reading *Sapiens: A Brief History of Humankind*.
This concept is very *important*.
This is a *déjà vu* moment.Notes
Using underscores in the middle of words may not be recognized:
✅ Recommended
*italic*text
❌ May not work
_italic_textBold Italic
Basic Syntax
Use *** or ___ to surround text:
***This is bold italic text***
___This is also bold italic text___Effect: This is bold italic text
Combined Use
**Bold and *bold italic* combination**
*Italic and **bold italic** combination*Effect: Bold and bold italic combination
Strikethrough
Basic Syntax
Use ~~ to surround text:
~~This is strikethrough text~~Effect: This is strikethrough text
Use Cases
- Mark completed tasks
- Show content before modification
- Indicate no longer valid information
~~Original Price ¥199~~ Current Price ¥99
Task: ~~Complete documentation~~ ✓Underline
Markdown natively does not support underline, use HTML:
<u>This is underlined text</u>Effect: This is underlined text
Highlight
Some Markdown parsers support highlighting:
==highlighted text==Or use HTML:
<mark>highlighted text</mark>Effect: highlighted text
Superscript and Subscript
Superscript
X<sup>2</sup>
E = mc<sup>2</sup>Effect: X2
Subscript
H<sub>2</sub>O
CO<sub>2</sub>Effect: H2O
Text Color
Use HTML and CSS:
<span style="color: red;">Red text</span>
<span style="color: blue;">Blue text</span>
<span style="color: green;">Green text</span>Effect:Red textBlue textGreen text
Text Size
<font size="5">Large text</font>
<font size="3">Normal text</font>
<font size="1">Small text</font>Or use CSS:
<span style="font-size: 20px;">Large text</span>
<span style="font-size: 12px;">Small text</span>Combined Formatting
Multiple Format Combination
***Bold italic*** and **bold *bold italic* bold**
~~Strikethrough **bold strikethrough**~~
*Italic `code` italic*Effect:
- Bold italic and bold bold italic bold
Strikethrough bold strikethrough- Italic
codeitalic
Nested Use
**Outer bold *inner italic* continue bold**
*Outer italic **inner bold** continue italic*Keyboard Keys
Use the <kbd> tag:
Press <kbd>Ctrl</kbd> + <kbd>C</kbd> to copy
Press <kbd>Ctrl</kbd> + <kbd>V</kbd> to paste
Press <kbd>Ctrl</kbd> + <kbd>S</kbd> to saveEffect:
Press Ctrl + C to copy
Abbreviations
Use HTML's <abbr> tag:
<abbr title="HyperText Markup Language">HTML</abbr>
<abbr title="Cascading Style Sheets">CSS</abbr>Effect: HTML
Quotes and Emphasis
Inline Quotes
According to *Markdown Guide*, **Markdown** is a lightweight markup language.Term Definitions
**Markdown**: A lightweight markup language.
**Git**: A distributed version control system.Special Symbols
Copyright Symbols
© 2024 Company Name
® Registered Trademark
™ TrademarkEffect: © 2024 Company Name
Arrow Symbols
← Left arrow
→ Right arrow
↑ Up arrow
↓ Down arrowEffect: ← → ↑ ↓
Math Symbols
× Multiplication
÷ Division
± Plus minus
≠ Not equal
≤ Less than or equal
≥ Greater than or equalEffect: × ÷ ± ≠ ≤ ≥
Text Alignment
Center Alignment
<center>Centered text</center>Or use div:
<div align="center">
Centered text
</div>Right Alignment
<div align="right">
Right aligned text
</div>Left Alignment (default)
<div align="left">
Left aligned text
</div>Text Indentation
Indented textOr use CSS:
<p style="text-indent: 2em;">
This is a paragraph with first-line indentation.
</p>Quote Styles
Warning Box
> ⚠️ **Warning**
>
> This is a warning message.Tip Box
> 💡 **Tip**
>
> This is a helpful tip.Note Box
> ⚡ **Note**
>
> This is something to pay attention to.Best Practices
1. Keep Consistent
Use the same formatting markers throughout the document:
✅ Recommended (unified use of **)
**bold1** and **bold2**
❌ Not Recommended (mixed use)
**bold1** and __bold2__2. Use Moderately
Don't overuse formatting:
✅ Recommended
This is a paragraph containing **important** content.
❌ Not Recommended
**This**is**a**paragraph**containing****important****content**.3. Semantic Use
Choose formatting based on content meaning:
**Definition**: Used for term definitions
*Emphasis*: Used to emphasize a word
~~Delete~~: Used to mark deleted content
`code`: Used for code or commands4. Readability First
✅ Recommended
This is **important** content.
❌ Not Recommended
This**important**content (close to Chinese)Shortcuts
VS Code
Ctrl/Cmd + B: BoldCtrl/Cmd + I: ItalicAlt + S: Strikethrough
Typora
Ctrl/Cmd + B: BoldCtrl/Cmd + I: ItalicAlt + Shift + 5: Strikethrough
Obsidian
Ctrl/Cmd + B: BoldCtrl/Cmd + I: Italic
Practice Exercises
Try creating text in the following formats:
- A paragraph containing bold and italic
- Use strikethrough to mark modified content
- Combine multiple formats
- Add keyboard shortcut instructions
- Use color to highlight key points
Format Comparison Table
| Format | Syntax | Effect |
|---|---|---|
| Bold | **text** | text |
| Italic | *text* | text |
| Bold Italic | ***text*** | text |
| Strikethrough | ~~text~~ | |
| Underline | <u>text</u> | text |
| Highlight | <mark>text</mark> | text |
| Superscript | X<sup>2</sup> | X2 |
| Subscript | H<sub>2</sub>O | H2O |
Summary
Text formatting is a basic function of Markdown. Using it properly can:
- Highlight key content
- Improve document readability
- Convey richer information
- Enhance visual effects
Remember: Formatting serves content, don't overuse it.
Next: Learn detailed usage of Markdown Lists.