sawhney17 / logseq-automatic-linker

MIT License
97 stars 18 forks source link

Page in links are linked incorrectly #15

Closed Xuanwo closed 2 years ago

Xuanwo commented 2 years ago

Hi, I found that automatic-linker will link the page in links.

For example:

[Page Test](https://example) => [[[Page]] Test](https://example)

This behavior doesn't make sense and will break the link in some cases.

Steps to reproduce

- Create a new page: [[Page]]
- Use this page in a link: [Page Test](https://example)

Expected

Convert into

- Use this [[page]] in a link: [Page Test](https://example)

Actual

automatic-linker will update it into:

- Use this [[page]] in a link: [[[Page]] Test](https://example)
slgardiner commented 2 years ago

I am having a similar issues with aliases; if I write something like [test](test/test) it will change it to [[[test]]]([[test/test]]) Adding double square brackets to the terms in the round brackets is fine and doesn't affect the alias, but the extra double square brackets around the first instance of test (the one in the initial set of square brackets) will also create extra pages with titles like [test or test]([[test/test]])

slgardiner commented 2 years ago

I think the desired behaviour would be to prefer a longer multi word link if one exists (since that's likely to be more specifically useful given the context) and to just completely ignore the case when the link would be in round parenthesis if those parentheses are preceded by something in square brackets. I don't know how to do that myself, otherwise I would open a pull request

andreoliwa commented 2 years ago

@slgardiner Your problem with aliases should have been fixed by #29.

The new release includes the fix: https://github.com/sawhney17/logseq-automatic-linker/releases/tag/1.3.0


The bug with Markdown links should be fixed by #30, not released yet.