Skip to content

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:

markdown
**This is bold text**
__This is also bold text__

Effect: This is bold text

Use Cases

  • Emphasize important content
  • Highlight keywords
  • Mark term definitions
markdown
**Note:** This is an important tip.
**Key Concept:** Markdown is a markup language.

Best Practices

markdown
✅ 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:

markdown
*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
markdown
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:

markdown
✅ Recommended
*italic*text

❌ May not work
_italic_text

Bold Italic

Basic Syntax

Use *** or ___ to surround text:

markdown
***This is bold italic text***
___This is also bold italic text___

Effect: This is bold italic text

Combined Use

markdown
**Bold and *bold italic* combination**
*Italic and **bold italic** combination*

Effect: Bold and bold italic combination

Strikethrough

Basic Syntax

Use ~~ to surround text:

markdown
~~This is strikethrough text~~

Effect: This is strikethrough text

Use Cases

  • Mark completed tasks
  • Show content before modification
  • Indicate no longer valid information
markdown
~~Original Price ¥199~~ Current Price ¥99
Task: ~~Complete documentation~~

Underline

Markdown natively does not support underline, use HTML:

markdown
<u>This is underlined text</u>

Effect: This is underlined text

Highlight

Some Markdown parsers support highlighting:

markdown
==highlighted text==

Or use HTML:

markdown
<mark>highlighted text</mark>

Effect: highlighted text

Superscript and Subscript

Superscript

markdown
X<sup>2</sup>
E = mc<sup>2</sup>

Effect: X2

Subscript

markdown
H<sub>2</sub>O
CO<sub>2</sub>

Effect: H2O

Text Color

Use HTML and CSS:

markdown
<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

markdown
<font size="5">Large text</font>
<font size="3">Normal text</font>
<font size="1">Small text</font>

Or use CSS:

markdown
<span style="font-size: 20px;">Large text</span>
<span style="font-size: 12px;">Small text</span>

Combined Formatting

Multiple Format Combination

markdown
***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 code italic

Nested Use

markdown
**Outer bold *inner italic* continue bold**
*Outer italic **inner bold** continue italic*

Keyboard Keys

Use the <kbd> tag:

markdown
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 save

Effect:

Press Ctrl + C to copy

Abbreviations

Use HTML's <abbr> tag:

markdown
<abbr title="HyperText Markup Language">HTML</abbr>
<abbr title="Cascading Style Sheets">CSS</abbr>

Effect: HTML

Quotes and Emphasis

Inline Quotes

markdown
According to *Markdown Guide*, **Markdown** is a lightweight markup language.

Term Definitions

markdown
**Markdown**: A lightweight markup language.
**Git**: A distributed version control system.

Special Symbols

markdown
&copy; 2024 Company Name
&reg; Registered Trademark
&trade; Trademark

Effect: © 2024 Company Name

Arrow Symbols

markdown
&larr; Left arrow
&rarr; Right arrow
&uarr; Up arrow
&darr; Down arrow

Effect: ← → ↑ ↓

Math Symbols

markdown
&times; Multiplication
&divide; Division
&plusmn; Plus minus
&ne; Not equal
&le; Less than or equal
&ge; Greater than or equal

Effect: × ÷ ± ≠ ≤ ≥

Text Alignment

Center Alignment

markdown
<center>Centered text</center>

Or use div:

markdown
<div align="center">
Centered text
</div>

Right Alignment

markdown
<div align="right">
Right aligned text
</div>

Left Alignment (default)

markdown
<div align="left">
Left aligned text
</div>

Text Indentation

markdown
&nbsp;&nbsp;&nbsp;&nbsp;Indented text

Or use CSS:

markdown
<p style="text-indent: 2em;">
This is a paragraph with first-line indentation.
</p>

Quote Styles

Warning Box

markdown
> ⚠️ **Warning**
>
> This is a warning message.

Tip Box

markdown
> 💡 **Tip**
>
> This is a helpful tip.

Note Box

markdown
> ⚡ **Note**
>
> This is something to pay attention to.

Best Practices

1. Keep Consistent

Use the same formatting markers throughout the document:

markdown
✅ Recommended (unified use of **)
**bold1** and **bold2**

❌ Not Recommended (mixed use)
**bold1** and __bold2__

2. Use Moderately

Don't overuse formatting:

markdown
✅ 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:

markdown
**Definition**: Used for term definitions
*Emphasis*: Used to emphasize a word
~~Delete~~: Used to mark deleted content
`code`: Used for code or commands

4. Readability First

markdown
✅ Recommended
This is **important** content.

❌ Not Recommended
This**important**content (close to Chinese)

Shortcuts

VS Code

  • Ctrl/Cmd + B: Bold
  • Ctrl/Cmd + I: Italic
  • Alt + S: Strikethrough

Typora

  • Ctrl/Cmd + B: Bold
  • Ctrl/Cmd + I: Italic
  • Alt + Shift + 5: Strikethrough

Obsidian

  • Ctrl/Cmd + B: Bold
  • Ctrl/Cmd + I: Italic

Practice Exercises

Try creating text in the following formats:

  1. A paragraph containing bold and italic
  2. Use strikethrough to mark modified content
  3. Combine multiple formats
  4. Add keyboard shortcut instructions
  5. Use color to highlight key points

Format Comparison Table

FormatSyntaxEffect
Bold**text**text
Italic*text*text
Bold Italic***text***text
Strikethrough~~text~~text
Underline<u>text</u>text
Highlight<mark>text</mark>text
SuperscriptX<sup>2</sup>X2
SubscriptH<sub>2</sub>OH2O

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.

Content is for learning and research only.