Markdown URL parsing when pasted into AnyType

WHAT IS THE BUG

When we paste some Markdown link in AnyType, it gets parsed automatically, which breaks some links, specifically, zotero links. This is probably the desired behavior for links following the https protocol, but for application level links like zotero:// or obsidian:// etc., this behavior breaks those links.

HOW TO REPRODUCE IT

(Keep in mind that this won’t work exactly for everyone because Zotero uses internal IDs for all items. So items/pdfs in your zotero library will have a different ID as compared to the one presented in this demo. BUT, you can still see how pasting the Markdown changes the link.)

  1. Copy the following Markdown link and paste it into AnyType.
[Page 58](zotero://open-pdf/library/items/8YSVCQQN?page=58)
  1. Click on the link. It should open http://zotero/open-pdf/library/items/8YSVCQQN?page=58 in the browser, instead of the desired behavior, which is opening this link using zotero.
  2. Hover over the pasted link in AnyType, and select the Edit Link option. It should display zotero:\open-pdf\library\items\8YSVCQQN?page=58 as its value (which is wrong).
  3. Now, in the Edit Link menu, replace the wrongly parsed link with the correct one, i.e., zotero://open-pdf/library/items/8YSVCQQN?page=58
  4. To confirm this as the new link, we have to scroll all the way down in the Edit Link options until we see the Link to website option. Select that. (This is cumbersome as if we only press enter after updating the link value, it’ll just select the first object from the options list and link it to that object, which is not what we want. And if we click outside the modal, it won’t update the link. So, we have no choice but to scroll all the way down to the “Link to Website” option :smiling_face_with_tear:)
  5. After updating the link manually, the link should now work and open the PDF at the specified page number inside Zotero.

THE EXPECTED BEHAVIOR

I expect the Markdown links to remain the same. They should not be broken and shouldn’t be processed if the protocol is not https.

I export all my annotations on my PDFs from Zotero into a Markdown file, which has a link to all the annotations inside Zotero, pointing to the exact location of the annotation inside the PDF. Below is an example of a couple of annotations exported:

- AI is undergoing a paradigm shift with the rise of models (e.g., BERT, DALL-E, GPT-3) trained on broad data (generally using self-supervision at scale) that can be adapted to a wide range of downstream tasks. We call these models foundation models to underscore their critically central yet incomplete character. [Page 1](zotero://open-pdf/library/items/8YSVCQQN?page=1&annotation=J77ZHRS4)


- Though foundation models are based on standard deep learning and transfer learning, their scale results in new emergent capabilities, and their effectiveness across so many tasks incentivizes homogenization. Homogenization provides powerful leverage but demands caution, as the defects of the foundation model are inherited by all the adapted models downstream. [Page 1](zotero://open-pdf/library/items/8YSVCQQN?page=1&annotation=EDA4E2V4)

- Despite the impending widespread deployment of foundation models, we currently lack a clear understanding of how they work, when they fail, and what they are even capable of due to their emergent properties. [Page 1](zotero://open-pdf/library/items/8YSVCQQN?page=1&annotation=LV7JGVBM)

Pasting this into AnyType breaks all the links, and given hundreds of annotations and the tedious process to manually edit the links, it’s infeasible for me to correct all the links manually.

ADDITIONAL CONTEXT

I believe this should be filed as a bug, as the team probably hadn’t thought of this scenario and the markdown parsing isn’t working correctly.

The desired behavior is that the markdown link shouldn’t be parsed, or only parsed if it’s an http/https link. I believe that when pasting markdown content or importing it from someplace, we can assume that the Markdown links are correct. I don’t see why we need to parse those. If those are incorrect, then the problem lies in the imported content, not in the way AnyType imports. That’s why I think parsing/reformatting the links isn’t required here. But there might be some cases which I’m forgetting about, so I can understand if there’s a need for it.

But besides http/https links, I don’t think we should parse/reformat those links. We should just import them as is. That won’t cause any issues I believe.

SYSTEM INFORMATION

OS version: win32 x64 10.0.22621 (Windows 11)
App version: 0.34.3
Build number: build on 2023-08-16 11:07:20 +0000 UTC from  at #2815587c8afa3f81e75336226cacecb7fe105e9c(v0.27.21)
Library version: v0.27.21

Hey @aadam,
totally get your problem here but do you really feel like this is a bug?

zotero:// links are internal links (if this is the correct terminology) so I think your problem might be better reflected by a feature request that asks either for easier editing of links in a situation like yours or, better, the handling of non-standard(?) links like the ones you mention.

I thought that it might go under bug as the team probably hadn’t thought of this scenario and the markdown parsing isn’t working correctly.
If you suggest, I can put it under a “feature request” (don’t think I’ll get enough votes and it’ll be fixed soon enough), but to me, it felt like a markdown parsing bug.

Fair enough, let’s leave it as a bug.

One thing I don’t get is this though:

What’s your expected behavior?

The desired behavior is that the markdown link shouldn’t be parsed, or only parsed if it’s an http/https link. I believe that when pasting markdown content or importing it from someplace, we can assume that the Markdown links are correct. I don’t see why we need to parse those. If those are incorrect, then the problem lies in the imported content, not in the way AnyType imports. That’s why I think parsing/reformatting the links isn’t required here. But there might be some cases which I’m forgetting about, so I can understand if there’s a need for it.

But besides http/https links, I don’t think we should parse/reformat those links. We should just import them as is. That won’t cause any issues I believe.

In your quoted scenario, it should have been the following link, instead of the HTTPS one:

zotero://open-pdf/library/items/8YSVCQQN?page=58
2 Likes

This report has been added to our issue tracker and received by the Development Team.

1 Like