You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating notes using pyzotero, the markdown formatting isn't being recognized. I've followed the documentation closely, but the created notes show markdown characters (such as #) instead of rendering them as intended, and collapse line breaks (\n) into whitespaces.
Here's a simplified Python code snippet to demonstrate the issue:
frompyzoteroimportzotero# Initialize Zotero APIlibrary_id="your_library_id"api_key="your_api_key"zot=zotero.Zotero(library_id, "user", api_key)
# Retrieve a sample itemsample_item=zot.top()[0]
# Create a note with markdown formattingnote_template=zot.item_template('note')
note_template['note'] ="# Note Title\n\nThis is a note."zot.create_items([note_template], sample_item['key'])
The created note should render the markdown formatting, displaying as follows in Zotero:
Note Title
This is a note.
Instead, this is what I see:
# Note Title This is a note.
When I export the resulting note in markdown, I get this with the hash symbol escaped:
\# Note Title This is a note.
At the very least I would like my created notes to respect line breaks in the content, otherwise the notes are unreadable in Zotero.
Additional Context:
Zotero version: 6.0.27
pyzotero version: 1.5.10
Python version: 3.11.4
OS: Windows 11
The text was updated successfully, but these errors were encountered:
I found a (perhaps hacky) solution: converting the content of the note from markdown to html using the markdown package before passing it to Zotero, like so:
Thanks for the quick response! In any case the html trick shared above works great. Perhaps there could be args in a future version of pyzotero to automatically handle the markdown-to-html conversion for markdown content, or at least something in the docs to explain how to preserve formatting (unless, of course, Zotero decides to change their API).
When creating notes using
pyzotero
, the markdown formatting isn't being recognized. I've followed the documentation closely, but the created notes show markdown characters (such as#
) instead of rendering them as intended, and collapse line breaks (\n
) into whitespaces.Here's a simplified Python code snippet to demonstrate the issue:
The created note should render the markdown formatting, displaying as follows in Zotero:
Instead, this is what I see:
When I export the resulting note in markdown, I get this with the hash symbol escaped:
At the very least I would like my created notes to respect line breaks in the content, otherwise the notes are unreadable in Zotero.
Additional Context:
pyzotero
version: 1.5.10The text was updated successfully, but these errors were encountered: