Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

item links broken in markdown export #35

Closed
Sleepwalker6 opened this issue Jun 2, 2022 · 42 comments
Closed

item links broken in markdown export #35

Sleepwalker6 opened this issue Jun 2, 2022 · 42 comments

Comments

@Sleepwalker6
Copy link

Sleepwalker6 commented Jun 2, 2022

  1. After exporting to markdown in obsidian links to annotaions are broken (both annotation page and the item). Item ID is missing.
  2. Shortcuts are missing in ouline area. There is only view mode.
    image

I am on widows 7 OS.
Thanks for the great addon.

@windingwind
Copy link
Owner

  1. Does this happens to EVERY link? Please check if the cited attachment is moved or deleted.
  2. These buttons are moved to the menu bar on the left top of the window.left top

@Sleepwalker6
Copy link
Author

Sleepwalker6 commented Jun 3, 2022

  1. Yes, every link is broken. ID of the items are all missing. Items and annotaions are not removed. Here is the difference between what it is and what it should be.
    1

  2. Thanks.

  3. I found another issue with the page number in the link to the annotaion. Page number in the link to the annotaion is a wrong page and is not the same with the alias shown before that.

2

thank you very much.

@windingwind
Copy link
Owner

So weird. This should not happen, for the code for generating this link is exactly the same as Zotero's official note2markdown code.

May I ask how did you get the right version?

@Sleepwalker6
Copy link
Author

Thanks.
Its an addon called zotero integration for obsidian

https://github.com/mgmeyers/obsidian-zotero-integration

@windingwind
Copy link
Owner

I compared the code of Zotero integration for obsidian, finding out that there does exist a difference when processing annotation links.

Better Notes follows the standard Zotero way, which means this might be a Zotero bug, or your annotation data is modified by some addons in a somehow non-standard way. You can try to export the note with Zotero's built-in note exporting function and see if it is broken.

As for the page, again, the int4ob uses pageLabel and we use position.pageIndex + 1, as Zotero does. I can't judge which one is right. I'd prefer to follow the Zotero way.

Here is the new version. Please download, unzip, and try and see if the bug is fixed.
test_version_35.zip

@Sleepwalker6
Copy link
Author

Sleepwalker6 commented Jun 3, 2022

I used zotero's export function(Right-click on the main note, select export note >choose markdown) and it was Ok. and exported md file has valid links and links are not broken.
I also used the test_version_35 and it still produces broken links.

For page number I think your addon does right and has no problem.

@windingwind
Copy link
Owner

Please try this and paste debug output here:
After installed, please go to Help->Debug Output Logging->View Output, and then do a note export.
After the export, please copy everything in the debug output window and paste them here.
test2.zip

@Sleepwalker6
Copy link
Author

Sleepwalker6 commented Jun 4, 2022

in the version you just sent (test2.zip) links to annotaion page is ok but link to the item is missing.

image

@windingwind
Copy link
Owner

Sorry for my late reply. I was just busy fixing bugs in the 0.5.x update. Is this bug still exist?

@Sleepwalker6
Copy link
Author

Sleepwalker6 commented Jun 18, 2022

Unfortunately I still have that problem.(zotero://select/library/items/items)
I am on 0.5.15.
Thanks

@windingwind
Copy link
Owner

@Sleepwalker6
It is very strange. The export works well with my notes.
Anyway, I use the same code as the Zotero default export for this part. as I've mentioned.
Do you have any ideas? Please provide any evidence that might be related to this bug. Or, did you try to disable all other addons and export again?

@Sleepwalker6
Copy link
Author

Thanks, I will try that with other addons disabled and also with another computer . I'll send the results here. Thank you

@Sleepwalker6
Copy link
Author

Sleepwalker6 commented Jun 20, 2022

I disabled All the addons except Zotero betternotes.
When I export the note using the addon I still have the issue with the link.
But exporting with zotero creates no problem at all.
image

I am on Win7 64, , zotero 6.0.8 and latest release of the addon.

@windingwind
Copy link
Owner

@Sleepwalker6

Please try the debug steps:

  1. Make sure there is at least one highlight annotation in your main note;
  2. Goto Tools->Developer->Run JavaScripts;
  3. Paste this code there and press 'Run'
var container = Zotero.Knowledge4Zotero.knowledge.parseNoteHTML();
var nodes = container.querySelectorAll(
  'span[class="highlight"], img[data-annotation]'
);
var annotation = JSON.parse(
  decodeURIComponent(nodes[0].getAttribute("data-annotation"))
);
let uri = annotation.attachmentURI || annotation.uri;
uri

image
4. Paste the output result here.

@windingwind windingwind mentioned this issue Jun 23, 2022
@Sleepwalker6
Copy link
Author

Sleepwalker6 commented Jun 23, 2022

I created new item in zotero, new pdf, new highlights, new main note.
Exported it with addon's export and the problem still exist. I dont have this problem with the zotero's export. It is strange.

I ran the java code and I got the result:
http://zotero.org/users/local/ydE4i5nD/items/GAU7HTQT

The image bellow can explain the difference between the two exported markdown files(zoter's and addon's exported md file)
image

  • Link to pdf page works in both files.
  • link to the item doesn't work in addon's file

@Sleepwalker6
Copy link
Author

Sleepwalker6 commented Jun 25, 2022

I tried above process on another computer:

  • win10 + all addons disabled >> The same results
    image

@windingwind
Copy link
Owner

So weird. The item link inside Zo is correct.
Please update to the latest version and try:

  1. Open 'Help->Debug output->View output' and do an export.
  2. Copy-paste all outputs here.

There should be item links like:

(3)(+0000001): Translate: http://zotero.org/users/6099279/items/9RJQMLTE

(3)(+0000000): Translate: 9RJQMLTE

(3)(+0000004): { "key": "ZWY9GYFU", "version": 7362, "itemType": "attachment", "parentItem": "9CYAM3SZ", "linkMode": "embedded_image", "contentType": "image/png", "filename": "image.png", "dateAdded": "2022-06-07T07:27:55Z", "dateModified": "2022-06-07T07:27:55Z" }

(3)(+0000163): Translate: C:\Users\w_xia\Zotero\storage\3YPFT4A2\image.png

(3)(+0000002): Translate: C:\Users\w_xia\Desktop\test\attachments\3YPFT4A2.png

(3)(+0000023): Translate: C:\Users\w_xia\Zotero\storage\ZJVYZSAL\image.png

(3)(+0000001): Translate: C:\Users\w_xia\Desktop\test\attachments\ZJVYZSAL.png

(3)(+0000002): Translate: C:\Users\w_xia\Zotero\storage\ZWY9GYFU\image.png

(3)(+0000001): Translate: C:\Users\w_xia\Desktop\test\attachments\ZWY9GYFU.png

@windingwind
Copy link
Owner

Seem like this only happens to you and I still don't know what's going on with your export. Using remote connection/control software would be more efficient to solve the problem if possible.

@Sleepwalker6
Copy link
Author

Sleepwalker6 commented Jun 26, 2022

Today I installed zotero (6.0.9) and the addon(0.5.17) on a new brand windows 10. (no other addon is installed)
and stills the problem exists.
I think there are others like me. Something is not right.

@windingwind
Copy link
Owner

Could you please show me the debug output?
I haven't received similar bug reports. As this issue has been open for weeks, it is possible that this only happens to you, or at least not all users.
I'll help you and try to figure out why. However, it is challenging for developers to fix a bug that cannot be reproduced. If possible, I would recommend allowing me to access your PC via remote control. If you do not trust third-party software, we could also use MS remote desktop.

@Sleepwalker6
Copy link
Author

Sleepwalker6 commented Jun 26, 2022

I should say I really appreciate your help and patience. Since I cheked the addon on 3 different pcs I thought I must be doing something wrong.
For links to zotero item and pdf page to work it seems that we need 3 different IDs.
image

  • The addon (for me) fails to produce ID#1 (which is GA3GVJD9 in this case according to zotro's native export).
  • Addon has no problem with creating ID#2 ( which VHPNJXBP)
  • The code you mentioned above produces ID#2 which was already OK with the addon.
  • What we need to chech is ability of the addon to produce ID#1 (GA3GVJD9)

Unfortunately I can't connect to remote control, but I will send debug output.

@windingwind
Copy link
Owner

Hi, I just made some fixes to the bugs with the export & quick note function.
Could you please check if the broken link & image loss bugs still happen?

@Sleepwalker6
Copy link
Author

Sleepwalker6 commented Jun 27, 2022

Hi Thanks, 5.18 didnt fix the item link.
v5.19 and 5.20 export emty files (0 byte md file) and don't export anything. The also fail to export annotations(for me).

@windingwind
Copy link
Owner

Hi Thanks, 5.18 didnt fix the item link. v5.19 and 5.20 export emty files (0 byte md file) and don't export anything. The also fail to export annotations(for me).

Sorry to hear that. However, this also means we might be close to the true cause of the bug.
I'd like to know:

  1. Is the main note/its linked sub-notes/annotations/citations in a group library?
  2. Does the progress window 'Export to xxx.md' show up when the latest version exports empty files? Does it happen to both two export ways, or just in one?
  3. Could you please paste the debug output?

Thanks a lot!

@Sleepwalker6
Copy link
Author

Sleepwalker6 commented Jun 27, 2022

Glad to hear that:
1- I normally have several collections. For the purpose of this tes I managed to have the item, annotation and main note in one collection;
image
2- I don't know what you mean by two export wayss, but with 5.20 and all the ways (3 ways to export) that I knew just empty file and attachment folder is created.
By progress windows I dont know what you mean, but the window to show the destination for export notes showed in each of the 3export ways.
image

@windingwind
Copy link
Owner

The progress window is:
image

And could you please show me the debug output? The blank output indicates there might be a conversion bug.
Thanks for your patience!

@Sleepwalker6
Copy link
Author

After checking that on 2 pcs:

  • Yes, It shows the progress window.
  • what I see while experimenting with the addon was that whenever main note contains images it creates empty file and attachment folder. However when there is only text in the main note the addon creates the markdown file with valid content.
  • Even when the file is ok the link problem (.../items/items) still remains unchanged.
  • currently I can't send the debug file. I'll try to send as soon as its possible.

@windingwind
Copy link
Owner

No hurry. You can also email me the debug file: wyzlshx@foxmail.com

@Sleepwalker6
Copy link
Author

Sleepwalker6 commented Jun 28, 2022

Do you have any ideas on what might be the problem? Can't you reproduce the current problem especially with 5.20 which the problem might seems even worse.
For a few days I won't be able to check the addons. In the mean time I hope others can help you.
Thanks

@windingwind
Copy link
Owner

The v0.5.19 & 20 fix the bugs below:

  1. Linked notes in different groups cause the output image lost.
  2. Async bugs with export. In old versions, the next export will not wait for the former one's finish. Thus sometimes the image will not be exported correctly.

These fixes are related to #68. However, in the case that your links are broken, the new code of image link parsing may be the cause of the blank export bug.

@Sleepwalker6
Copy link
Author

Hi @windingwind .
Thanks for the new updates. If I am not mistaken the export problem still isn't fixed in v0.6.1. Is it in your to do list?
To refresh your memory:

  • Till v 0.5.18 I had broken links and misplaced images in exporting linked notes.
  • Since V 0.5.19 the addon creates empty files (empty md file and empty attach folder) whenever there are images in the note.
    Thanks

@windingwind
Copy link
Owner

Hi, fixing this bug is planned as always. I am waiting for the debug output😳

Please send me the output when you have the blank file exported?

@windingwind
Copy link
Owner

Any updates?

@Sleepwalker6
Copy link
Author

just sent a debug file.
Thanks

@windingwind
Copy link
Owner

Thanks. I've emailed you a new version of this plugin.

@windingwind
Copy link
Owner

Any updates?

@Sleepwalker6
Copy link
Author

Sleepwalker6 commented Jul 29, 2022 via email

@Sleepwalker6
Copy link
Author

Sleepwalker6 commented Jul 29, 2022 via email

@windingwind
Copy link
Owner

glad to know the blank file bug is fixed. I’ll install a new Zotero using local library recently to see what’s happening to the links.

about the [] conversion: should I just disable this conversion rule([]=>[]), or just disable it for the [!note] case?

@Sleepwalker6
Copy link
Author

Sleepwalker6 commented Jul 30, 2022 via email

@windingwind
Copy link
Owner

I just tested on my new Zotero environment and everything seems to be OK now. Could you please try the latest version?
BTW, the [] conversion is not handled yet.

I guess the images are correctly exported now. Please also check #75 .

Thanks for the patience!

windingwind pushed a commit that referenced this issue Aug 1, 2022
resolve: #35 export MD without [] conversion
fix: export MD not correctly await bug
add: default settings
@windingwind
Copy link
Owner

The [] conversion is supported in the latest release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants