You’re reading the ZotLit v2 docs. Still on v1? Read the v1 docs

ZotLit

How to export with native Pandoc

Use ZotLit's integration pair with your installed Pandoc CLI, a Better CSL JSON bibliography, and Literature Note citations.

Use this guide when you need your own Pandoc installation, bibliography file, CSL options, or command-line workflow.

To learn both export routes with one worked note, follow Build a Pandoc citation workflow.

Requirements

You need:

  • Pandoc 3.1.1 or newer.
  • Obsidian 1.14.2 or newer.
  • Obsidian installer 1.13.4 or newer, with Command line interface enabled.
  • Zotero 9 or newer.
  • Obsidian running with the input vault open and ZotLit loaded.
  • The obsidian launcher available to Pandoc.

This workflow uses your installed Pandoc CLI. It is separate from ZotLit's managed Pandoc engine and built-in export command.

Set up the workflow

Save the ZotLit integration pair

Open Settings > ZotLit > Citations > Native Pandoc workflow. In that group, find Pandoc integration pair and select Save integration files.

Choose a user-owned workflow folder. ZotLit saves zotlit-cite.lua and zotlit.yaml there.

Keep both files together under these names. Save a fresh pair after every ZotLit update. Files saved from a version before ZotLit 2.2.0 do not work with 2.2.0 or later.

Create a bibliography

Better BibTeX is recommended for citation key management and automatic bibliography updates.

In Zotero, right-click the library, group library, or collection that contains your cited items. Select Export and choose Better CSL JSON. Enable Keep updated, then save references.json.

The export updates after its source library or collection changes. See the Better BibTeX automatic export guide for its update controls.

Without Better BibTeX, right-click the library or collection, select Export, choose CSL JSON, and save references.json. Export it again after the cited Zotero data changes.

BibLaTeX and BibTeX are also supported. The command below uses CSL JSON.

Prepare a Literature Note citation

Confirm that the cited Zotero item has a citation key and a ZotLit Literature Note. In your input note, add an unaliased link to that Literature Note with a Citation Fragment:

This result follows the earlier analysis [[Doe 2020#cite:locator=33]].

Replace Doe 2020 with the exact link target of your Literature Note. The locator fragment becomes a page locator in the Pandoc citation.

Set the document style and language

Without a style property, the note cites with the style ZotLit selects for it in Obsidian. For an Imported Note, that is its profile's style. For every other note, it is your Citation and references style. Set a style here only when this note needs a different one.

Open the input note and run:

ZotLit: Set citation presentation

Select a CSL style installed in Zotero, or select Vault style (…). Enter the complete document's language, then select Save.

When you select a named style, the note frontmatter contains its Zotero style ID and a Pandoc language tag:

---
zotlit-csl: http://www.zotero.org/styles/nature
lang: en-US
---

The note must not also contain csl or citation-style for this path. Vault style (…) removes zotlit-csl, and the note returns to the vault or profile style.

Use a Pandoc-owned style instead

A document can keep a sole standard csl or citation-style input, and you can pass --csl on the command line. Remove zotlit-csl for that path. The ZotLit filter reports csl-ambiguous when a document contains both csl and zotlit-csl.

Run Pandoc with absolute paths

Keep Obsidian open with the input vault and ZotLit loaded. Run the canonical command with absolute paths:

pandoc "/absolute/path/to/input.md" --defaults "/absolute/path/to/workflow/zotlit.yaml" --bibliography "/absolute/path/to/references.json" --fail-if-warnings --output "/absolute/path/to/output.docx"

Replace each example path. Keep --fail-if-warnings so a warning stops the run instead of producing an unchecked document.

Verify the result

Confirm that the output .docx exists and opens.

Pandoc prints one ZotLit line in the terminal that names the style and where it comes from:

ZotLit: citations use APA Style 7th edition (from your vault settings).

Check that the line names the style you expect. The source reads from this note, from the Research profile, from your vault settings, or from the csl field or the --csl option. When your vault selection is Default, the line names the Pandoc default style, Chicago author-date. This line is not a warning, so --fail-if-warnings does not stop the run.

Check that [[Doe 2020#cite:locator=33]] became a formatted citation with locator 33. Confirm that the document contains the corresponding formatted bibliography entry.

Fix a failed run

Open Pandoc CLI guide under Settings > ZotLit > Citations > Native Pandoc workflow for the full error reference.

Error codeRecovery
file-not-foundUse the absolute path of a Markdown file inside the open vault.
database-unavailableRepair the Zotero database connection in ZotLit.
item-not-foundCorrect the Literature Note's zotero-key, or restore the item.
citation-key-missingAssign a citation key to the resolved Zotero item.
duplicate-citation-keyGive the cited items distinct citation keys.
unresolved-citation-intentPoint the #cite: link to a valid Literature Note.
style-missingInstall the named style in Zotero, or change the style where it is set: zotlit-csl, the ZotLit settings, or the profile.
style-property-invalidSet zotlit-csl to the ID of a style installed in Zotero, or remove it.
language-property-invalidSet lang to a language tag such as en-US, or remove it. ZotLit checks lang only when the note has no zotlit-csl or csl.
profile-unavailableSwitch the note to an available profile in Obsidian.
parent-missingInstall the dependent style's independent parent in Zotero.
csl-ambiguousKeep only standard csl or zotlit-csl.

Refresh both integration files when the saved pair came from an earlier ZotLit version. A pair saved before ZotLit 2.2.0 does not work with 2.2.0 or later. Keep the pair together when you move the workflow folder.

See also

Last updated on

On this page