Skip to content

ส่วนอ้างอิง (Footnotes) ​

Footnotes เป็นความสามารถแบบขยายของ Markdown ที่ช่วยเพิ่มบันทึกอ้างอิงหรือข้อมูลเพิ่มเติมลงในเอกสาร ทำให้ผู้อ่านดูคำอธิบายเพิ่มเติมได้โดยไม่ขัดจังหวะการอ่าน

ไวยากรณ์พื้นฐาน ​

การเพิ่มส่วนอ้างอิง ​

การสร้าง Footnote ใน Markdown แบ่งเป็นสองส่วน: สัญลักษณ์อ้างอิงในเนื้อหา และเนื้อหาของรายการอ้างอิง

markdown
This is a paragraph containing a footnote[^1].

[^1]: This is the footnote content.

ผลลัพธ์การเรนเดอร์:

This is a paragraph containing a footnote[^1].

[^1]: This is the footnote content.

หลายรายการอ้างอิง ​

markdown
Markdown is a lightweight markup language[^1] created by John Gruber[^2], now widely used in writing[^3].

[^1]: Markdown uses simple syntax to achieve text formatting.
[^2]: John Gruber created Markdown in 2004.
[^3]: Many platforms such as GitHub, Stack Overflow, and blog platforms support Markdown.

ผลลัพธ์การเรนเดอร์:

Markdown is a lightweight markup language[^2], created by John Gruber[^3], now widely used in writing[^4].

[^2]: Markdown uses simple syntax to achieve text formatting. [^3]: John Gruber created Markdown in 2004. [^4]: Many platforms such as GitHub, Stack Overflow, and blog platforms support Markdown.

การใช้งานขั้นสูง ​

ตัวระบุส่วนอ้างอิง ​

ตัวระบุส่วนอ้างอิงอาจเป็นตัวเลขหรือคำ แต่ต้องไม่มีช่องว่างหรือแท็บ

markdown
Here is a regular footnote[^1] and a footnote with an identifier[^note].

[^1]: This is a regular footnote.
[^note]: This is a footnote with an identifier.

ผลลัพธ์การเรนเดอร์:

Here is a regular footnote[^5] and a footnote with an identifier[^note].

[^5]: This is a regular footnote. [^note]: This is a footnote with an identifier.

ส่วนอ้างอิงหลายย่อหน้า ​

เนื้อหาใน Footnote สามารถมีหลายย่อหน้า/องค์ประกอบได้ โดยต้องจัดย่อหน้าให้ถูกต้อง

markdown
This is a footnote containing multiple paragraphs[^multipara].

[^multipara]: This is the first paragraph of the footnote.

    This is the second paragraph of the footnote. Indent at least four spaces or one tab.

    > You can also include blockquotes in footnotes.

    - You can also include lists
    - Both ordered and unordered lists are supported

ผลลัพธ์การเรนเดอร์:

This is a footnote containing multiple paragraphs[^multipara].

[^multipara]: This is the first paragraph of the footnote.

This is the second paragraph of the footnote. Indent at least four spaces or one tab.

> You can also include blockquotes in footnotes.

- You can also include lists
- Both ordered and unordered lists are supported

ส่วนอ้างอิงแบบอินไลน์ ​

บางตัวแปรของ Markdown รองรับไวยากรณ์ Footnote แบบอินไลน์ (ไม่ใช่มาตรฐานหลัก)

markdown
This is an inline footnote^[Add footnote content directly in the text rather than at the end of the document].

ผลลัพธ์การเรนเดอร์ (บนแพลตฟอร์มที่รองรับ):

This is an inline footnote^[Add footnote content directly in the text rather than at the end of the document].

ความเข้ากันได้และความแตกต่างในการใช้งาน ​

สถานะการรองรับบนแพลตฟอร์มต่าง ๆ ​

แพลตฟอร์ม/เครื่องมือมาตรฐาน Footnotesอินไลน์ Footnotesหลายย่อหน้า
GitHub Markdown✅❌✅
GitLab Markdown✅✅✅
Jekyll (kramdown)✅✅✅
Hugo✅✅✅
CommonMark❌❌❌
VitePress✅✅✅
Pandoc✅✅✅

รูปแบบผลลัพธ์ HTML ​

ตัวเรนเดอร์ Markdown ส่วนใหญ่จะแปลงเป็น HTML พร้อมลิงก์และปุ่มย้อนกลับ

html
<!-- Footnote reference -->
<p>This is a paragraph containing a footnote<sup id="fnref:1"><a href="#fn:1" class="footnote-ref">1</a></sup>.</p>

<!-- Footnote content (usually at the end of the document) -->
<div class="footnotes">
  <hr>
  <ol>
    <li id="fn:1">
      <p>This is the footnote content.<a href="#fnref:1" class="footnote-backref">↩</a></p>
    </li>
  </ol>
</div>

คำแนะนำและแนวปฏิบัติที่ดี ​

ควรใช้ Footnotes เมื่อใด ​

เหมาะสำหรับสถานการณ์ต่อไปนี้:

  1. การอ้างอิงแหล่งข้อมูล: งานวิจัย หนังสือ หรือเนื้อหาอ้างอิง
  2. คำอธิบายเพิ่มเติม: ให้ข้อมูลเพิ่มโดยไม่รบกวนเนื้อหาหลัก
  3. อ่านเพิ่มเติม: ชี้แหล่งข้อมูลสำหรับผู้สนใจ
  4. อธิบายคำศัพท์: ศัพท์เทคนิคหรือคำย่อ

ข้อเสนอแนะด้านการจัดวาง ​

✅ แนวปฏิบัติที่แนะนำ:

  1. วางเนื้อหา Footnote ไว้ท้ายเอกสาร: ช่วยให้บำรุงรักษาง่าย
  2. คงความสม่ำเสมอ: รูปแบบการทำเครื่องหมาย (ตัวเลข/ตัวระบุ)
  3. ใช้เท่าที่จำเป็น: มากเกินไปจะรบกวนผู้อ่าน
  4. ให้เนื้อหาที่มีความหมาย: ไม่ซ้ำซ้อนกับเนื้อหาหลัก

❌ ควรหลีกเลี่ยง:

  1. ใช้ Footnote หลายรายการในประโยคเดียว
  2. ใช้ Footnote แทนการนำเสนอแกนหลักของเนื้อหา
  3. เนื้อหา Footnote ยาวเกินไป
  4. ซ้อน Footnote ซ้ำซ้อน

Footnotes ในเอกสารขนาดยาว ​

สำหรับเอกสารยาวมาก สามารถจัดกลุ่มตามบทได้

markdown
# Chapter 1

This is the content of Chapter 1, containing a footnote[^1-1].

[^1-1]: The first footnote of Chapter 1.

# Chapter 2

This is the content of Chapter 2, containing another footnote[^2-1].

[^2-1]: The first footnote of Chapter 2.

แนวทางแก้ปัญหาที่พบบ่อย ​

Footnotes ไม่แสดงผล ​

หาก Footnote ไม่แสดงผลอย่างถูกต้อง:

  1. ตรวจสอบว่าตัวระบุและรายการนิยามตรงกันทุกประการ (รวมถึงตัวพิมพ์)
  2. ตรวจสอบรูปแบบนิยาม (ต้องมีช่องว่างหลังโคลอน)
  3. ตรวจสอบว่าตัวเรนเดอร์รองรับไวยากรณ์ Footnote
  4. ลองเว้นบรรทัดว่างก่อนและหลังรายการนิยาม Footnote

หมายเลข Footnote สับสน ​

บางตัวเรนเดอร์จะกำหนดเลข Footnote ใหม่โดยอัตโนมัติ ซึ่งถือว่าเป็นพฤติกรรมปกติ โดยผลลัพธ์แสดงเลขเรียงต่อกัน

การใช้งานบนอุปกรณ์พกพา ​

บนอุปกรณ์พกพา ลิงก์ Footnote อาจแตะได้ยาก การใช้ตัวอ่านที่รองรับการพรีวิว Footnote แบบโฮเวอร์ช่วยได้

ไวยากรณ์ที่เกี่ยวข้อง ​

แบบฝึกหัดและการประยุกต์ใช้ ​

  1. เขียนบทความสั้นที่มี Footnote อย่างน้อย 3 รายการ
  2. ลองสร้าง Footnote ที่มีหลายย่อหน้า
  3. ใช้ Footnote อ้างอิงแหล่งข้อมูลในบทความวิชาการ/เทคนิค

Footnotes เป็นเครื่องมือสำคัญที่ช่วยเพิ่มความเป็นมืออาชีพและความน่าเชื่อถือให้กับเอกสาร Markdown ช่วยให้เพิ่มข้อมูลโดยไม่รบกวนเนื้อหาหลัก ทำให้เอกสารครบถ้วนและมีน้ำหนักมากขึ้น

สร้างโดย www.markdownlang.com