CLI for retrieving bibliographic metadata through Zotero Translation Server and writing CSL-JSON metadata into Markdown YAML frontmatter.
Related project: BibLib for Obsidian — see the CLI documentation for detailed usage.
- Resolve DOI/ISBN/PMID/arXiv identifiers and URLs through Translation Server
- Convert translator output to CSL-JSON
- Write/merge frontmatter into Markdown files
- Optional built-in Translation Server management via Node process
- Config at
~/.config/biblib/config.yaml
npm install
npm run build
npm linkClone and install translation-server once:
git clone https://github.com/zotero/translation-server.git ~/projects/translation-server
cd ~/projects/translation-server
npm install- Initialize config:
biblib init-config-
Set
serverManagement.sourcePathin~/.config/biblib/config.yamlif needed. -
Start Translation Server from source:
biblib server start- Fetch metadata:
biblib fetch "10.1038/s41586-020-2649-2" --format json- Write frontmatter into a note:
biblib write "10.1038/s41586-020-2649-2" notes/example.md --ensure-serverbiblib init-config [--force]biblib fetch <query> [--format json|yaml|frontmatter] [--output path] [--server-url url] [--ensure-server]biblib write <query> [markdown-file] [--replace] [--dry-run] [--attachments|--skip-attachments] [--server-url url] [--ensure-server]biblib from-json <json-file> <markdown-file> [--replace] [--dry-run]biblib server status [--server-url url]biblib server start [--server-url url]biblib server stop
Default path: ~/.config/biblib/config.yaml.
rootFolderPath: /home/youruser/notes
translationServerUrl: http://127.0.0.1:1969
requestTimeoutMs: 20000
literatureNoteTag: literature_note
literatureNotePath: .
attachmentFolderPath: attachments
filenameTemplate: "@{{citekey}}"
customFrontmatterFields:
- name: year
template: "{{year}}"
enabled: true
citekey:
template: "{{author_family}}{{year}}"
minLength: 6
randomDigits: 4
write:
mergeStrategy: shallow
preserveFields:
- tags
attachments:
enabled: false
maxFiles: 3
pdfOnly: true
createSubfolderByCitekey: true
timeoutMs: 30000
serverManagement:
enabled: true
autoStart: true
sourcePath: /home/youruser/projects/translation-server
nodeCommand: node
pidFile: /home/youruser/.cache/biblib/translation-server.pid
logFile: /home/youruser/.cache/biblib/translation-server.log
startupTimeoutMs: 20000
pollIntervalMs: 500Set serverManagement.enabled: true and serverManagement.autoStart: true if you want fetch and write to auto-start the local source server when unreachable.
All note and attachment paths are resolved relative to rootFolderPath unless you pass an absolute path.