Abbreviations for links in the same namespace with page

Handling specific case for links abbreviations: only hide those part of link, which duplicate page name.

This perfectly reduces redundant information.

Demo

Example

Links in page «Namespace/Subpage»:

* [[Namespace/Subpage/Item 1]]
* [[Namespace/Subpage/Item 2]]
* [[Namespace/Subpage/Item 3]]

Will be displayed as:

* [[↳ Item 1]]
* [[↳ Item 2]]
* [[↳ Item 3]]

And in page «Namespace» — as:

* [[↳ Subpage/Item 1]]
* [[↳ Subpage/Item 2]]
* [[↳ Subpage/Item 3]]

But in any «Other Page» — will be displayed fully:

* [[Namespace/Subpage/Item 1]]
* [[Namespace/Subpage/Item 2]]
* [[Namespace/Subpage/Item 3]]

How to install?

  1. Copy this code to <PATH TO YOUR GRAPH>/logseq/custom.js file.
  2. Enjoy the :sparkles:

Just updated the code: fix another portion of bugs and expand abbreviation only on anchor (↳) hover.

2 Likes

This would be great pacakged into a plugin!

1 Like

I’ll totally do it later

Now it is available in Marketplace as a plugin :tada:

GitHub ↑

1 Like