Skip to content

How much of a PDF's structure survives as Markdown

Markdown is text with its structure written in: a line that starts with # is a heading, a line that starts with - is a list item. A PDF does not record any of that, only where each word sits and how big it is, so the structure is worked out from the page. For most reports and notes that works well; for designed layouts it works less well.

Updated

Which tool you need

  • Notes, a report or documentation for a wiki or a repository

    PDF to Markdown. Larger type becomes headings, bulleted and numbered lines become lists, and paragraphs are joined with split words mended.

  • Text for an AI tool or a notes app

    PDF to Markdown keeps the headings, which helps a model or a notes app tell sections apart. Mark where each page starts if you need to cite pages.

  • Just the words, with no formatting at all

    PDF to Text writes a plain .txt file, in reading order or with the layout kept.

    PDF to Text

  • Form values, bookmarks and page details for a program

    PDF to JSON exports the document's structure and data, with each page's text if you want it.

    PDF to JSON

How headings are found

The tool measures the size most of the text is set in and treats that as the body. A short line set clearly larger becomes a heading — the largest steps become #, the next ##, then ###.

A heading set in bold at body size cannot be told apart from a sentence by size alone, so it stays a paragraph. Check the headings after converting a document that styles them that way.

What the Markdown looks like

Headings start with one, two or three # signs, and each paragraph is written as a single line with a blank line after it. Numbered items keep the number the document gave them, so clause 12 stays clause 12 rather than being counted again from one, and bulleted items start with a dash.

Characters Markdown would treat as formatting, such as asterisks, square brackets or a # at the start of a line, are escaped with a backslash, so a rendered view shows them as the PDF printed them. With page marking on, every page after the first starts below a horizontal rule, and each page carries an HTML comment naming its number, which a rendered view does not display.

When the structure comes out wrong

The body size is measured across all the pages you chose together, not page by page. A section set in noticeably larger type than the rest of the document can therefore have its short lines turned into headings, and converting that section on its own gives it a body size of its own.

Size alone does not make a heading: a large paragraph that runs past two lines, or past about 140 characters, stays a paragraph, which keeps a pull quote or an oversized introduction out of the headings. Lists are found only by the bullet or number at the start of a line, so items set as indented lines with no marker come out as an ordinary paragraph.

What to know before you start

  • Tables come out as lines of text, not Markdown tables.
  • Bold, italics, links and pictures are not carried over.
  • A scan has no words to convert, only a picture of them, and the result names every page that came out empty.
  • Lists lettered a, b, c are not taken for lists, because a single letter and a full stop is as often someone's initial.

Read next