Zotero 8: issue about the html2markdown translator

43 views
Skip to first unread message

iseexuhs

unread,
Jul 21, 2025, 8:37:17 AMJul 21
to zotero-dev
Hello, Zotero Team,

Previously, I use the following codes to convert html to markdown.(these codes are also inside the Zotero own editorInstance.js file)

```
function html2markdown(html) {

   let item = new Zotero.Item('note');
   item.libraryID = Zotero.Libraries.userLibraryID;
   item.setNote(html);
   let text = '';
   var translation = new Zotero.Translate.Export;
   translation.noWait = true;
   translation.setItems([item]);
   translation.setTranslator(Zotero.Translators.TRANSLATOR_ID_NOTE_MARKDOWN);
   translation.setHandler("done", (obj, worked) => {
      if (worked) {
      text = obj.string.replace(/\r\n/g, '\n');
      }
   });
   translation.translate();
   return text;
}
```

However, in Zotero 8, the codes fail to work.

Look forward to the favor from the Zotero Team. Thanks very much.
Reply all
Reply to author
Forward
0 new messages