Skip to content
Edit this page

Converting and re-converting

The menus

Right-click items in your library to get these entries (at the bottom of the menu, after a separator):

Entry Shown when
Convert with Docling the selection includes at least one PDF
Re-convert with Docling (replace) at least one selected PDF already has its .md
Export markdown to .zip the selection includes at least one PDF
Remove images from markdown the selection includes at least one converted .md

The Tools menu has the same actions for the current selection, plus one that only appears while a conversion batch runs:

  • Docling: Export markdown to .zip…
  • Docling: Remove images from markdown…
  • Docling: Stop after the PDFs in progress

A selection can be PDF attachments, parent items (each parent's PDF children are used), or any mix. Other items are ignored, and a PDF selected twice is converted once.

Convert with Docling

For each PDF, the plugin:

  1. Checks the PDF can be converted: it must be a PDF attachment with a parent item and its file must be on this computer (stored or linked; not a link to a URL, not a file that hasn't synced yet). Others are skipped.
  2. Skips it if Skip items that already have a Markdown attachment is on (the default) and its .md already exists. The match is by filename, so paper.pdf is only skipped if the same parent has paper.md; a parent with two PDFs gets each converted on its own.
  3. Sends it to docling-serve with your conversion settings, on the sync endpoint or, if you turned it on, the async endpoint.
  4. Builds the Markdown: YAML frontmatter first (if on), then the document, with page-number markers (if on).
  5. Attaches it as a child of the same parent, named <pdf name>.md with the content type text/markdown, and also writes it to the export folder if you set one.

Before the batch starts, the plugin checks GET /health once. If the server isn't reachable you get one message, "docling-serve isn't running — start it and retry", instead of one error per PDF.

When the batch ends, the progress window shows OK n · skipped n · failed n, the elapsed time, and the first couple of error or skip reasons.

Only one manual batch runs at a time. Starting a second shows "A conversion batch is already running — wait for it to finish". A manual batch and auto-convert can run side by side and share the same conversion slots.

Status tags

After a batch, each parent item gets exactly one tag, replacing any earlier docling/* tag:

Tag Meaning
docling/done every PDF of this parent converted
docling/incomplete some converted, some failed
docling/error every PDF of this parent failed

A parent whose PDFs were all skipped keeps the tag it had.

Re-convert with Docling (replace)

Converts again even if the .md exists, then replaces it:

  • Only PDFs that already have their .md are re-converted. PDFs without one are left out (use Convert for those).
  • A confirmation dialog comes first. Tick Don't ask again to stop it, or turn it back on with Confirm before "Re-convert (replace)" replaces existing markdown in Behavior.
  • The old .md stays in place until the new one is attached, then moves to the Zotero trash, where you can restore it. If the conversion fails, the old .md is not touched.
  • With Attach the .md as a Zotero child attachment off, Re-convert only writes the export folder and leaves the existing attachment as it is. The dialog says so.

Auto-convert on import

Tick Auto-convert new PDF attachments on import in Behavior (off by default). New PDF attachments are queued as they arrive and converted 3 seconds after the last one, so a bulk import becomes one batch.

  • Only new PDFs. Your existing library isn't converted.
  • PDFs without a parent item are skipped, the same as a manual conversion.
  • If docling-serve isn't running, auto-convert tries again every minute, three times, then gives up on those PDFs with a message.
  • If Remove Images is running, auto-convert waits for it.
  • Each auto-convert batch ends with a summary message and sets status tags, like a manual batch.

Where the output goes

Two outputs, set in Output. Both can be on.

  • Attach the .md as a Zotero child attachment (on by default).
  • Export folder: an absolute path. Every converted .md is also written there, named after the parent's citation key, or its Zotero item key if it has none. The file is written to a temporary name and moved into place, so a folder watcher never sees half a file.

If both are off, conversions are skipped with "No output target".

The citation key comes from Zotero's Citation Key field, or else a Citation Key: … line in Extra (where Better BibTeX puts it).

Two PDFs under one parent share an export filename

The export folder file is named after the parent, so if a parent has two PDFs, both conversions write the same file and the last one wins. The Zotero attachments are named after each PDF and don't clash.

If writing to the export folder fails but the attachment worked, the conversion counts as OK with a warning. If the export folder is the only output, it counts as failed.

YAML frontmatter

On by default (Prepend YAML frontmatter with Zotero metadata). The block lists whichever of these the parent item has:

---
title: "Attention Is All You Need"
authors: ["Vaswani, Ashish", "Shazeer, Noam"]
year: 2017
doi: "10.48550/arXiv.1706.03762"
url: "https://arxiv.org/abs/1706.03762"
zotero_key: "ABCD1234"
citation_key: "vaswani2017"
---

authors lists the item type's primary creators (authors for most types), so editors and translators aren't included. year is the first four-digit year in the item's date.

Exclude images

By default docling-serve embeds every figure in the Markdown as base64 data (image_export_mode=embedded), which can add tens of megabytes to one paper. Tick Exclude images — keep only text and tables to send image_export_mode=placeholder instead: each figure becomes an <!-- image --> comment.

Page numbers

Tick Add page-number markers to mark where each PDF page starts. Marker format sets the text, with {page} replaced by the page number. The default, <!-- page {page} -->, doesn't show when the Markdown is rendered:

<!-- page 1 -->

First page text…

<!-- page 2 -->
  • Numbers are page positions in the PDF (1, 2, 3, …), not the page numbers printed in a journal. A blank page still gets its marker.
  • With this on, the plugin also asks docling-serve for its JSON version of the document (to_formats=json), so each response is about twice as large. With embedded images, the images are sent twice.
  • If the plugin can't match docling's page data to the Markdown, it writes no page numbers for that file rather than guess, and logs why in Help → Debug Output Logging. The rest of the Markdown is unchanged. One known case: a figure or table caption whose content spans pages, on docling versions before 2.102.
  • Inside lists, or text that runs across a page break, a marker can land a few lines after the true start of its page. The order is always right.
  • If Advanced JSON sets md_page_break_placeholder or to_formats, the plugin leaves page breaks as docling-serve returns them.

Remove images from markdown

Rewrites .md attachments you already have, replacing every Markdown image and HTML <img> tag with <!-- image -->. Use it to shrink Markdown that was converted with embedded images, without converting again.

  • Select .md attachments, PDFs (their matching .md is used) or parents (the matching .md of each of their PDFs). A hand-written notes.md under a parent is only touched if you select it directly.
  • A confirmation dialog comes first. The image data is deleted for good; re-convert the PDF to get it back.
  • Code blocks are left alone.
  • It doesn't run while a conversion batch runs, and vice versa.

Export markdown to .zip

Bundles the Markdown of the selected items into one .zip.

  1. Select PDF attachments, parent items, or a mix.
  2. Choose Export markdown to .zip from the right-click menu or the Tools menu. With nothing selected, the plugin asks you to select items first.
  3. If some PDFs have no .md yet, choose Skip and export, Convert first (converts those PDFs, then exports), or Cancel.
  4. Pick where to save (default name docling-markdown-YYYY-MM-DD.zip). The plugin asks before replacing an existing file.

The zip is flat. Each file is named <citation key>.md, or <Zotero item key>.md without one. When a parent has more than one converted PDF, the next ones get .1.md, .2.md and so on. Names that differ only by case are treated as the same name.

Parallel conversions

Parallel conversions in Behavior (1–8, default 1) sets how many PDFs a batch converts at once.

  • How many docling-serve actually runs at once is the server's DOCLING_SERVE_ENG_LOC_NUM_WORKERS (default 2). On a stock server, 2 with the async endpoint is the useful setting.
  • On the sync endpoint the plugin never runs more than 2 at once, whatever the setting, because extra sync requests wait in the server's queue and hit its 120-second sync limit (HTTP 504).
  • On the async endpoint with the setting above 1, the plugin keeps 2 more PDFs queued at the server than the setting, so its workers don't sit idle between jobs. At most 2 PDFs upload at a time.
  • With more than 1, the largest PDFs start first, so the batch doesn't end with one big PDF running alone.
  • Don't start docling-serve with --workers. See Setting up docling-serve.

Stopping a batch

There's no Cancel, because docling-serve can't cancel a conversion (see No cancel, by design). While a batch runs, Tools → Docling: Stop after the PDFs in progress stops it from sending more PDFs. PDFs already sent still finish and are attached; the rest are counted as skipped ("Stopped before it started").