Package: zendron
ShowcaseHere we show howzendronenables a writing workflow from within VsCode.First we show how you can structure a paper using note references in Dendron.Installzendronand import references from the relevant Zotero library.Cite while you write, and view all relevant Zotero metadata, annotations, and comment notes with hover.Compile paper to.docx,.pdf, and.htmlwith Pandoc.Find relevant papers via VsCode search.IntroductionThis package was developed for porting Zotero annotations and metadata to markdown. This is made possible withpyzotero. These markdown notes are then brought into aDendronhierarchy for integration with vault notes. Zendron is designed to be used withVisual Studio Codebut is editor agnostic... in theory. The end goal is to get a two way sync between notes in Zotero and notes in Dendron, but this has some difficulties and limitations. For now only a one way sync from Zotero to Dendron is supported.Install InstructionsIt is recommended to build a virtual environment for installation. I've usedconda envduring development.InstallDendron CLIthis is needed for note import into Dendron.Install node jsFor more information you can check outDendron node install instructionnpm install -g @dendronhq/dendron-cli@0.119.0I use the global flag, but you can alternativley install a specific version for a given workspace.Newer version are not working, waiting on any response togithub issueInstall the zendronpython -m pip install zendronZotero Local SetupTo start you needBetter BibTeX for ZoteroThis allows pinning of bibtex keys. A stable bibtex key is necessary for predictable behavior withinzendron.Go toZotero > Settings... > Advanced > General > Config EditorAccept the risks.In the Search, typeautoPinDelayand change the integer value from 0 (default) to 1. Click OK.This will automatically pin any new publications coming into your zotero database. For previous citations that are not yet pinned, you can highlight all metadata, right click and selectBetter BibTex > Pin BibTeX key. This will make your entries compatible with Zendron. This is a one time thing, after setting theautoPinDelay, you won't need to worry about this.Zotero API keyVisit here to setup aZotero API key.We recommend setting up your Zotero API key with the following settings to allow for full functionality.Personal LibraryAllow library access.Allow notes access.Allow write access.Default Group PermissionsRead/WriteThis key can then be copy-pasted in the configuration file,"config.yaml". You should add your key to.gitignoreto prevent others from accessing your Zotoero database. If the key is lost you can always generate a new one.Basic Usage🚨THE MOST IMPORTANT THING🚨 - When you anyzendroncommand make sure that you have a clean working directory. Meaning rungit status, and make sure there are no untracked files or files to commit. This makes it very easy to revert modifications made byzendronwhile we still work out the kinks.There is 1 command, and 3 optional flags.zendronThis command should only be run in the root directory of the workspace.This command imports notes according to a definedconfig.yaml. Once the command is run the first time the user needs to modify their configuration./conf/zendron/config.yaml. All required configs are marked with a comment# STARTER CONFIGupon initialization.Notes are imported with a## Time Createdheading. This allows for stable reference from other notes, within the note vault. We autogenerate a*.comments.mdthat should be used for taking any additional notes within Dendron. Additional notes taken within the meta data file (notes/zendron.import.<paper-title>.md), or the*.annotations.mdwill be overwritten after runningzendron -rmorzendron -nc. All files downstream of.importexcept*.comments.mdshould be treated as read only.Upon import, notes and tags are left as stubs. To create these notes run> Dendron: DoctorthencreateMissingLinkedNotes. It is best practice to correct tag warnings before doing this. We warn on malformed tag imports. We could reform tags and sync to Zotero if there is interest.After running this command it is best to runDendron: Reload Indexfrom the command palette.zendron -horzendron --helpHelp message that shows availbe commands and suggsetions for when runningzendron.zendron -rmorzendron --remove⚠️ This command removes imported notes and associated links. This command works by removing all notes downstream todendron_limb. There is some difficulty removing other files created because these are separate from thedendron_limb. These files includeuser.*.md, which comes from bibtex keys, andtags.*.mdwhich come from metadata and annotation tags. For now, we don't remove tags, but we do remove bibex keys (<user.bibtex_key>.md).⚠️I have to say it again, don't put other notes downstream of the zendron limb. They will be deleted.We don't delete imported tags because they are too difficult to track consistently.zendron -drmorzendron --dry-removeA dry removal so you can see what file will be deleted without deleting them.zendron -ncorzendron --no-cacheThis is zendron sync without caching. This good to run if you interrupted your import for some reason and need a fresh clean import. If your zendron notes are misbehaving try this command. It will be slower since there is no caching.After running this command it is best to runDendron: Reload Indexfrom the command palette.Zotero and File Import ConfigurationAll zendron configuration is handled inconfig.yaml. Upon initialization it will show in"config/zendron/config.yaml".library_id : 4932032 # Zotero library ID
library_type : group # [user, group] library
api_key : FoCauOvWMlNdYmpYuY5JplTw # Zotero API key
collection: null # Name of Zotero Collection, null for entire library
local_image_path: /Users/<username>/Zotero/cache # Local path for importing annotated imagesdefault.yamlitem_types:[journalArticle,book,preprint,conferencePaper,report]# List of item types according to [pyzotero](https://pyzotero.readthedocs.io/en/latest/). Kept here for beginner simplicity.dendron_limb:zendron.import# Dendron import limb e.g. zendron.import.paper-title.annotations.md. KEEPING here for now since hasn't been tested.zotero_comment_title:zendron comment# needed for eventual 2-way sync. HERE for now.pod_path:zendron_pod# Name of dendron pod, removed after completion of import. Key for non dendron user import. Not implemented yet.library_id- Integer identifier of library. This is the number that matches the name of a library.User ID. For a user library it you will see something like"Your userID for use in API calls is 1234567"For group ID visitZotero Groups, click on your desired group, and copy the id from the URL. For instance I have this library."https://www.zotero.org/groups/4932032/zendron/library", and 4932032 is thelibrary_id.library_type:groupfor group libraries anduserfor user library.api_key: Use the API Key obtained fromZotero API KEY.collection: This can be the name of any collection or subcollection in the specificed library. If there are multiple collections or sub collections with the same name, the import will arbitrarily choose one. To make sure you are importing the desired collection, make sure the name of the collection is unique in the Zotero library. Subcollections of a collection will not be imported, this is by design according to how zotero handles subcollections and collections.item_types: Zotero item types to import according topyzoterosyntax.local_image_path: Path to annotated images./Users/<username>/Zotero/cacheis the default path on MacOS. It just needs to end incache.dendron_limb: This is the period deliminated hierarchy prefix to all file imports for Dendron, e.g.root.zotero.import.<paper_title>.annotations.md.pod_path- pod path for dendron import. Should not need to change. Will likely remove from configuration later so it doesn't get accidentally changed.zotero comment title- IGNORE FOR NOW. Eventually needed for 2-way sync.Import StructureWhen a paper is uploaded it will look something like this in your dendron graph.Comments notes are synced back to zotero after runningzendron. They are stored in a file calledzendron_commentsin the note data. After removing all data and runningzendronagain the comments created previously in a local workspace should be imported again. This allows for comments to be easily ported accross projects that reference the same papers.Comments notes are intended to be used for reference to any annotations under a Zotero item's metadata. This will preserve dendron linking with two-way sync.Supplementary importWe support import of supplementary pdfs if they have any of the following prefixes in their pdf title. This can be easily edited within Zotero. We can move this to configuration if custom naming is desired.["supp","Supp","supplementary","supp.","supplementary-material","supplementary-materials","sup","SI","si",]MiscellaneousThezendron_cacheis used for remove of<user.bibtex_key>.md. If it is deleted and you run remove, the<user.bibtex_key>.mdwill not be removed. In this case you can runzendronagain, then run thezendron remove=trueagain.If there are run that fail, sometimes a.hydrawith the given configuraiton will be generated in the root dir. This isn't an issue but it contains the API information and should therefore be added to the.gitignoreas a safeguard. In addition these files can be used to inspect the reason for the faiure.__main__.logis generated after running azendron, this can also be deleted as you please. It is also useful for inspecting an failures to import.Issues, Troubleshooting, Pull RequestsIf you are having trouble with startup you can use thisZendron-Testtemplate and try to reproduce your issues here. Simply click onUse this template, clone the repo and try to runzendronhere. This will allow for us to catch things we overlooked for different user workspace configuration etc. Once you have tried to reproduce issues here please submit an issue onZendronlinking to your minimal example.Common ErrorsA list of common errors and quick fixes to address them.Error - DendronError: vault with name your-vault-name not foundDendronError:vaultwithname<your-vault-name>notfoundFix - DendronError: vault with name your-vault-name not foundThis indicates that the vault name indendron.ymlwas not set.For example,workspace:vaults:-fsPath:.selfContained:truename:ZendronError - You see a Dendron Pod in your WorkspaceDendron PodA Dendron Pod is used for import according topod_pathin theconfig.yaml. This dir structure is normally deleted to allow for future importing. If you see it, something is wrong. Create an issue on GitHub, or delete the dir and retry the steps above.Fix - You see a Dendron Pod in your WorkspaceDelete the pod and rerun zendron to complete. If there is an additional error please report it.