Markdown เป็น PDF
แปลงไฟล์ .md เป็น PDF โดยคงหัวข้อไว้เป็นสารบัญ
เครื่องมือนี้ทำงานในเบราว์เซอร์ของคุณทั้งหมด ไฟล์ของคุณไม่ถูกอัปโหลดเลย และคุณตรวจสอบได้เองในแท็บเครือข่ายของเบราว์เซอร์ ตรวจสอบด้วยตัวเอง เปิดแท็บเครือข่ายของเบราว์เซอร์แล้วดู คุณจะเห็นคำขอเล็ก ๆ หนึ่งรายการที่ถามว่าคุณยังมีโควตางานเหลืออยู่หรือไม่ ซึ่งมีแค่ชื่อเครื่องมือกับค่าแฮช ไม่ใช่ตัวไฟล์
เครื่องมือนี้ทำอะไร
This reads a Markdown file and lays it out as a PDF directly, without going through HTML on the way. Headings, lists, tables, block quotes, links and fenced code blocks all come across, and the headings also become a real PDF outline. Markdown has no pages of its own, so the pagination is created here rather than reproduced from anywhere - the paper size, margins and theme you pick are what decide where the breaks fall.
Use it when the reader has no Markdown reader: a README that has to go into a tender pack, meeting notes an editor wants as an attachment, a specification circulating for comment, or documentation you want on paper with a table of contents that works.
วิธีทำงาน
- Drop your .md or .markdown files onto this page. Up to 20 at a time, each up to 50 MB.
- Pick a theme. Plain sets 11 pt with 1.45 line spacing, Book loosens to 11.5 pt and 1.6 for something read end to end, and Technical tightens to 10 pt and 1.35 for reference material that gets scanned rather than read.
- Choose the paper size, orientation and margins. Normal margins are 56 points on every side.
- Leave bookmarks from headings on so the finished PDF opens with a working outline, and turn page numbers off if the document already numbers itself.
- Under advanced options, decide whether YAML front matter at the top of the file should supply the document title.
- Press Convert. Each file becomes its own PDF and the downloads start on their own.
The parser walks Markdown into the document model directly and never renders it to HTML first. That sounds like an implementation detail and is not: a Markdown-to-HTML-to-PDF route escapes the content twice, and every escaping bug in that round trip shows up later as a stray ampersand or a visible line-break tag in somebody's finished document. Going straight to the model means the text you wrote is the text that gets measured.
Headings become the PDF outline, which is the thing that makes a long Markdown document usable as a PDF at all. A forty-page specification without an outline is a scroll bar and nothing else. One hash through six become outline entries at the matching depth, so the structure you already have in the file is the navigation the reader gets, with no extra step and nothing to maintain separately.
GitHub-flavoured extensions are on, so tables, strikethrough, task lists and bare URLs behave the way they do on GitHub rather than being left as literal punctuation. Fenced code blocks are set in Noto Sans Mono at 92 per cent of the body size, on a tinted wash, and a block longer than the remaining space is split across pages with the wash redrawn rather than being pushed whole onto the next sheet. Long code lines are folded, with the continuation indented to match the line it came from and the break preferred at a space so an identifier is not cut in half.
Images referenced by the Markdown are not embedded, and raw HTML blocks are not rendered. A Markdown file points at its pictures by path or by URL rather than containing them, and going out to fetch one would be exactly the outbound request this tool exists not to make. Convert the pictures separately with Images to PDF and join the results with Merge PDF if they need to be in the same document.
The Book theme asks for a serif face, and it is worth knowing what that gets you. With Embed a Unicode font on, which is the default, there is no Noto Serif in the embedded set, so serif borrows the sans faces and what you actually gain is the looser leading and the larger type. Turn embedding off and the text really is set in Times Roman, at the cost of every character outside the WinAnsi range.
สิ่งที่เครื่องมือนี้ทำไม่ได้
- Images referenced by the Markdown are not embedded. Fetching them would mean an outbound request; convert them with Images to PDF and combine the results instead.
- Raw HTML inside the Markdown is not rendered. Structure written as Markdown converts; structure written as HTML tags does not.
คำถามที่คนมักถาม
- เครื่องมือนี้เข้าใจ Markdown สำเนียงไหน
- CommonMark บวกส่วนขยายของ GitHub ได้แก่ ตาราง ข้อความขีดฆ่า รายการสิ่งที่ต้องทำ และ URL เปล่าที่กลายเป็นลิงก์ หัวข้อ รายการแบบมีลำดับและไม่มีลำดับ รายการซ้อน บล็อกคำพูด เส้นคั่น โค้ดในบรรทัด และบล็อกโค้ดแบบมีรั้ว รองรับทั้งหมด ส่วน YAML front matter ที่หัวไฟล์จะถูกอ่านเป็นชื่อเอกสารเมื่อเปิดตัวเลือกนั้นไว้ แทนที่จะถูกพิมพ์ออกมาเป็นตาราง
- หัวข้อของฉันจะกลายเป็นสารบัญไหม
- ใช่ เมื่อเปิดการสร้างบุ๊กมาร์กจากหัวข้อ เครื่องหมาย # หนึ่งตัวถึงหกตัวจะกลายเป็นรายการในสารบัญของ PDF ที่ระดับความลึกตรงกัน ผู้อ่านจึงได้แผงนำทางที่สร้างจากโครงสร้างซึ่งมีอยู่ในไฟล์ของคุณอยู่แล้ว ไม่ต้องเพิ่มอะไรลงใน Markdown และไม่ต้องคอยไล่แก้ให้ตรงกันด้วยมือ
- ทำไมรูปภาพใน Markdown ของฉันถึงหายไป
- เพราะไฟล์ Markdown แค่อ้างถึงรูปภาพแทนที่จะบรรจุไว้ในตัว และการไปดึงรูปมาก็เท่ากับหน้านี้ต้องส่งคำขอแทนคุณ ซึ่งเป็นสิ่งเดียวที่เครื่องมือทุกตัวที่นี่ปฏิเสธจะทำ ข้อความ ตาราง รายการ ลิงก์ และโค้ดแปลงได้ทั้งหมด ถ้ารูปภาพสำคัญ ให้นำรูปไปผ่านเครื่องมือรูปภาพเป็น PDF แล้วรวมสองเอกสารเข้าด้วยกันด้วยเครื่องมือรวมไฟล์ PDF
- บล็อกโค้ดแบบมีรั้วถูกจัดอย่างไร
- จัดด้วย Noto Sans Mono ที่ 92 เปอร์เซ็นต์ของขนาดตัวเนื้อความ บนพื้นสีอ่อน โดยแตกแท็บเป็นสี่ช่องว่างก่อนวัดอะไรทั้งสิ้น บรรทัดที่กว้างกว่าคอลัมน์จะถูกพับลงมาแทนที่จะถูกตัดทิ้ง ส่วนที่พับลงมาจะย่อหน้าให้ตรงกับบรรทัดต้นทาง และจุดพับจะเลือกช่องว่างก่อน ชื่อยาว ๆ จึงยังอยู่เป็นชิ้นเดียว
- เอกสารของฉันถูกอัปโหลดเพื่อแปลงไหม
- ไม่ ไฟล์ถูกถอดรหัส แยกวิเคราะห์ และจัดหน้าใน Web Worker ภายในเบราว์เซอร์ของคุณ และไฟล์ PDF ก็ถูกเขียนขึ้นที่นั่น สิ่งเดียวที่หน้านี้ดึงมาคือฟอนต์ Noto จากโดเมนของเว็บไซต์นี้เอง และเมื่อเบราว์เซอร์แคชไว้แล้ว การแปลงก็ทำงานได้แม้ปิดการเชื่อมต่อ