DocPress

Markdown to PDF with a table of contents

Paste Markdown and get a PDF whose contents page is built from your headings, with dotted leaders and page numbers that are computed at layout time, so they are always right. Preview free in the browser without an account, or set toc: true on an API request.

How the contents page is built

  • Second-level (##) and third-level (###) headings are listed, in document order. The single # heading is treated as the document title.
  • Page numbers come from the layout engine, not from a guess, so inserting a paragraph on page 3 updates every entry after it.
  • Each entry is a link to its heading, so it is clickable in PDF viewers that support internal links.
  • The contents page follows the cover (if any) and precedes the body. The report theme also numbers the headings in the body.

In the browser, no signup

Open the studio, paste or upload your .md file, keep Table of contents ticked, and press Preview PDF. The preview shows the finished layout with a watermark; a clean export is $5 per document, paid by card, no account needed. Previews are deleted after 24 hours.

From the API

{"markdown": "# Field guide\n\n## Setup\n\n### Requirements\n\n...\n\n## Operation\n\n...", "theme": "report", "cover": true, "toc": true, "author": "Ops team", "date": "October 2026"}

Send that as the JSON body of POST https://docpress.dev/v1/pdf with your bearer key. The free plan includes 50 documents a month with a footer mark. Markdown to PDF API has the full field list.

Tips for a tidy contents page

  • Use one # heading for the title and ## for chapters; deeper levels than ### are left out of the contents on purpose.
  • Keep headings short; long ones wrap and push the page number to the next line.
  • Headings that repeat the same text get distinct link targets automatically, but readers find them confusing. Prefer unique names.
  • If you only want a contents page for a long document, turn the cover off and keep the table of contents on.

Questions

Does the table of contents include the H1?

No. The first # heading is the document title (and the cover title, if a cover is on). The contents lists ## and ### headings.

Can I turn it off?

Yes. Untick Table of contents in the studio, or send toc: false (the default) on the API.

Does it work for HTML input too?

The automatic contents page is for Markdown input. For HTML, build your own list of links and add a::after { content: leader('.') target-counter(attr(href), page) } to the css field; the engine fills in the page numbers.

Is the preview really free?

Yes. Previews are free and carry a watermark. A clean export is $5 per document. There is no account and no subscription for the studio.

Related

Free previews carry a watermark and are deleted after 24 hours. Free API output carries a footer mark. The renderer runs no JavaScript and never fetches external URLs. Privacy · Terms · Refunds