راهنمای سریع Markdown

راهنمای مرجع کامل برای سینتکس Markdown

بر اساس مشخصات GitHub Flavored Markdown (GFM) و CommonMark

سینتکس پایه

عناصر بنیادی Markdown اصلی

عناوین (سبک ATX)

# Heading 1Heading 1
## Heading 2Heading 2
### Heading 3Heading 3
#### Heading 4Heading 4
##### Heading 5Heading 5
###### Heading 6Heading 6

عناوین (سبک Setext)

سینتکس
Heading 1
=========

Heading 2
---------
نتیجه
Heading 1Heading 2

تأکید و فرمت‌بندی

*italic*italic
_italic_italic
**bold**bold
__bold__bold
***bold italic***bold italic
~~strikethrough~~strikethrough

کد درون‌خطی

`code`code
``code with `backtick` ``code with `backtick`
نکته
وقتی کد شما شامل بک‌تیک تکی است از بک‌تیک دوتایی استفاده کنید.

بلوک‌های کد (Fenced Code Blocks)

سینتکس
```javascript
function greet(name) {
  console.log(`Hello, ${name}!`);
}

greet("World");
```
نتیجه
function greet(name) {
console.log(`Hello, ${name}!`);
}

greet("World");
زبان‌های پشتیبانی شده برای هایلایت سینتکس
javascriptjavascripttypescripttypescriptpythonpythonjavajavacccppcppcsharpcsharpgogorustrustrubyrubyphpphpswiftswiftkotlinkotlinscalascalasqlsqlbashbashshellshellpowershellpowershelljsonjsonyamlyamlxmlxmlhtmlhtmlcsscssscssscsssasssassmarkdownmarkdownlatexlatexrrmatlabmatlabperlperllualuahaskellhaskellelixirelixirclojureclojuredockerfiledockerfilenginxnginxapacheapachegraphqlgraphqlprismaprismasoliditysolidity

لینک‌ها

[text](url)text
[text](url "title")text
<https://example.com>https://example.com
لینک مرجع
[text][ref]

[ref]: https://example.com "Title"

تصاویر

سینتکس
![Alt text](url)
با عنوان
![Alt text](url "Title")
تصویر با لینک
[![Alt](image.jpg)](link)
مرجع
![Alt][ref]

[ref]: url "Title"

لیست‌های بدون ترتیب

سینتکس
- Item 1
- Item 2
  - Sub-item 2.1
  - Sub-item 2.2
    - Sub-sub-item
- Item 3

* Also works with *
+ And with +
نتیجه
  • Item 1
  • Item 2
    • Sub-item 2.1
    • Sub-item 2.2
      • Sub-sub-item
  • Item 3

لیست‌های مرتب

سینتکس
1. First item
2. Second item
   1. Sub-item 2.1
   2. Sub-item 2.2
3. Third item

1. Numbers don't need
1. to be in order
1. Markdown fixes it
نتیجه
  1. First item
  2. Second item
    1. Sub-item 2.1
    2. Sub-item 2.2
  3. Third item

نقل قول‌ها (Blockquotes)

سینتکس
> This is a quote.
> It can span multiple lines.
>
> > Quotes can be nested.
> > Like this one.
>
> And continue after.
نتیجه
This is a quote. It can span multiple lines.
Quotes can be nested. Like this one.
And continue after.

خطوط افقی

سینتکس
---

***

___
نتیجه

افزونه‌های GFM

ویژگی‌های اضافی GitHub Flavored Markdown

جداول

سینتکس
| Product    | Price  | Quantity |
|------------|:------:|---------:|
| Apple      | $3     |       10 |
| Banana     | $2     |       25 |
| Orange     | $4     |       15 |

تراز:
:--- چپ
:---: وسط
---: راست
نتیجه
ProductPriceQuantity
Apple$310
Banana$225
Orange$415

لیست‌های وظایف

سینتکس
- [x] Completed task
- [x] Another done task
- [ ] Pending task
- [ ] Another pending
نتیجه
  • Completed task
  • Another done task
  • Pending task
  • Another pending

لینک‌های خودکار

URLها و ایمیل‌ها به طور خودکار لینک می‌شوند
www.example.com
https://example.com
[email protected]

هشدارها/Callouts (GitHub)

سینتکس
> [!NOTE]
> Useful information that users
> should know.

> [!TIP]
> Helpful advice for doing
> things better or more easily.

> [!IMPORTANT]
> Key information users need
> to know to succeed.

> [!WARNING]
> Urgent info that needs
> immediate attention.

> [!CAUTION]
> Negative potential consequences
> of certain actions.
نتیجه
NoteUseful information that users should know.
TipHelpful advice for doing things better.
ImportantKey information for success.
WarningCritical content needing attention.
CautionNegative consequences of certain actions.

سینتکس گسترش‌یافته

ویژگی‌های پیشرفته که توسط برخی پارسرها پشتیبانی می‌شوند

پانویس‌ها

سینتکس
Here's a sentence with
a footnote.[^1]

[^1]: This is the footnote.

You can also use text[^note].

[^note]: Notes can have
    multiple lines.
نتیجه

Here's a sentence with a footnote.[1]

You can also use text[note].

[1] This is the footnote.
[note] Notes can have multiple lines.

لیست‌های تعریف

سینتکس
Term 1
: Definition of term 1

Term 2
: Definition of term 2
: Second definition of term 2
نتیجه
Term 1
Definition of term 1
Term 2
Definition of term 2
Second definition of term 2

متن برجسته

==highlighted text==highlighted text
توجه
توسط برخی پارسرها مانند Obsidian، Notion و دیگران پشتیبانی می‌شود.

زیرنویس و بالانویس

H~2~OH2O
X^2^X2
جایگزین HTML
H<sub>2</sub>O
X<sup>2</sup>

ایموجی‌ها

:smile:😄
:heart:❤️
:rocket:🚀
:+1:👍

اختصارات

سینتکس
HTML is widely used on the web.

*[HTML]: HyperText Markup Language
نتیجه
HTML is widely used on the web.

فرمول‌های ریاضی (LaTeX)

درون‌خطی
The formula $E = mc^2$ is famous.
نتیجه
The formula E = mc² is famous.
بلوک
$$
\frac{n!}{k!(n-k)!} = \binom{n}{k}
$$
نتیجه
n!k!(n-k)! = (nk)

HTML و عناصر خاص

استفاده از HTML درون‌خطی و کاراکترهای خاص

HTML درون‌خطی

عناصر پشتیبانی شده
<kbd>Ctrl</kbd> + <kbd>C</kbd>

<mark>Highlighted text</mark>

<details>
<summary>Click to expand</summary>
Hidden content here.
</details>

<br> for line break
نتیجه
Ctrl + C
Highlighted text
Click to expand
Hidden content here.

فرار کاراکترها

از \ قبل از کاراکترهای خاص استفاده کنید
\*text between asterisks\*
\# not a heading
\[not a link\]
\\ backslash
کاراکترهایی که می‌توانند فرار کنند
\ ` * _ { } [ ] ( ) # + - . ! |

شکست خطوط

روش‌ها
Line 1  
Line 2 (2 spaces at the end)

Line 1<br>
Line 2 (HTML tag)

Line 1

Line 2 (blank line = paragraph)

موجودیت‌های HTML

&copy;©
&reg;®
&trade;
&nbsp;(فاصله نشکن)
&lt; &gt;< >
&amp;&

ویژگی‌های پیشرفته GitHub

ویژگی‌های خاص GitHub Flavored Markdown

نمودارهای Mermaid

نمودار جریان
```mermaid
flowchart LR
    A[Start] --> B{Decision}
    B -->|Yes| C[Action 1]
    B -->|No| D[Action 2]
    C --> E[End]
    D --> E
```
نتیجه
Start
Decision
Yes →
Action 1
No →
Action 2
End
نمودار دایره‌ای
```mermaid
pie title Distribution
    "Movies" : 80
    "Series" : 20
```
نمودار توالی
```mermaid
sequenceDiagram
    Alice->>Bob: Hello Bob!
    Bob-->>Alice: Hi Alice!
```

کلیدهای صفحه‌کلید (kbd)

سینتکس
<kbd>Ctrl</kbd> + <kbd>C</kbd>

<kbd>Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd>

<kbd>
  Enter ↵
</kbd>
نتیجه
Ctrl + C
Cmd + Shift + P
Enter ↵

عناصر تاشو

سینتکس
<details>
  <summary>Click to expand</summary>

  Hidden content that will
  be revealed on click.

  - Item 1
  - Item 2
  - Item 3
</details>
نتیجه
Click to expand

Hidden content that will be revealed on click.

  • Item 1
  • Item 2
  • Item 3

ذکرها و مراجع

ذکر کاربران
@username
@organization/team
ارجاعات Issue و PR
#123
GH-123
username/repo#123
organization/repo#123
نتیجه
@usernameکاربر را ذکر می‌کند
#123به issue/PR #123 ارجاع می‌دهد
repo#456در مخزن دیگر ارجاع می‌دهد

مدل‌های رنگ

سینتکس
`#ffffff`
`#0969DA`
`rgb(9, 105, 218)`
`hsl(212, 92%, 45%)`
نتیجه
#ffffff
#0969DA
rgb(9, 105, 218)
hsl(212, 92%, 45%)

نظرات

سینتکس
<!-- This is a comment -->
<!-- 
  Multi-line
  comment
-->
نتیجه
(نظرات در سند رندر شده نامرئی هستند)

SHA کامیت‌ها

سینتکس
a1b2c3d
a1b2c3d4e5f6g7h8i9j0
username/repo@a1b2c3d
نتیجه
a1b2c3dلینک به کامیت
repo@a1b2c3dکامیت در مخزن دیگر

کد با Diff

سینتکس
```diff
- const old = "old value";
+ const new = "new value";

  function unchanged() {
-   return false;
+   return true;
  }
```
نتیجه
- const old = "old value";
+ const new = "new value";
 
  function unchanged() {
- return false;
+ return true;
  }

لنگرها و لینک‌های داخلی

ایجاد لنگر
<a name="section"></a>
## My Section
لینک به لنگر
[Go to section](#section)
[Back to top](#top)

تصاویر با اندازه

استفاده از HTML
<img src="image.png" width="300">

<img src="image.png" 
     width="200" 
     height="100" 
     alt="Description">

<p align="center">
  <img src="logo.png" width="150">
</p>
نکته
وقتی نیاز به کنترل ابعاد یا تراز تصویر دارید از HTML استفاده کنید.

فهرست مطالب

سینتکس
## Table of Contents

- [Introduction](#introduction)
- [Installation](#installation)
  - [Requirements](#requirements)
  - [Setup](#setup)
- [Usage](#usage)
- [Contributing](#contributing)

نشان‌ها/Shields

سینتکس
![Badge](https://img.shields.io/badge/
  text-color-style)

[![npm](https://img.shields.io/npm/v/
  package.svg)](link)

![GitHub stars](https://img.shields.io/
  github/stars/user/repo)
نتیجه
build: passingversion: 1.0.0license: MITdocs: latest

تراز متن

سینتکس
<div align="center">
  Centered text
</div>

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

<p align="center">
  <strong>Centered bold</strong>
</p>
نتیجه
Centered text
Right-aligned text
Centered bold

ابزارها و منابع

لینک‌های مفید برای کار با Markdown

مراجع و منابع