dendronhq / dendron

The personal knowledge management (PKM) tool that grows as you do!
https://wiki.dendron.so
Apache License 2.0
6.68k stars 252 forks source link

Option to fold/collapse the URL part of a markdown link #1751

Open aleksey-rowan opened 2 years ago

aleksey-rowan commented 2 years ago

Please select if your request is either something new or an enhancement

Please select the area your request applies to. (Multiple selections are possible)

Is your feature request related to a problem? Please describe

When inserting links to resources with long URLs or base64-encoded data, resulting links are cumbersome to use and they take up a lot of space. Like this Google Maps link:

[Wellesley to Severn](https://www.google.com/maps/dir/43.5918249,-80.6148742/44.7356773,-79.6835935/@44.016405,-81.115561,483716m/data=!3m1!1e3!4m13!4m12!1m5!3m4!1m2!1d-80.7995998!2d44.083526!3s0x882a2a729ae7cdb3:0x56598fa0d2365421!1m0!2m3!6e0!7e2!8j1633971600!3e0)

image

Describe the solution you'd like

The URL part of the markdown link is automatically folded/collapsed and expands only under the cursor. Something like this:

[Wellesley to Severn](...)

image

Describe alternatives you've considered

There is no alternative.

Additional context

VSCode had a similar request but it got closed (https://github.com/microsoft/vscode/issues/87797); another related issue is still open, but it doesn't look like anything is happening with it (https://github.com/microsoft/vscode/issues/50840).

hikchoi commented 2 years ago

Thank you for the suggestion. Unfortunately I think inline folding is not possible at the moment. This is definitely something we want once we have control over it though.

We'll keep this brewing in the backburner for now.

aleksey-rowan commented 2 years ago

As a workaround, you could try using the Inline-fold extension.

bonnebulle commented 8 months ago

Thanks @aleksey-rowan exactrly what I was searching ... for Wikilinks : Exemple : [[gparent.parent.child_name]] -> [[child_name]] I cant find any issue here, nor in the doc

My setup/settings with Inline-fold extension :

  "[markdown]": {
    "inlineFold.regex":"\\[\\[(([\\.A-Za-zÀ-ú0-9_\\-\\:]{1,}?)\\.)([A-Za-zÀ-ú0-9_\\-\\:]{1,}?)\\]\\]",
    "inlineFold.regexFlags": "g",
    "inlineFold.regexGroup": 1,
    "inlineFold.unfoldedOpacity": 0.6,
    "inlineFold.maskChar": "",
    "inlineFold.after": "",
    "inlineFold.maskColor": "#000",
    "inlineFold.unfoldOnLineSelect": true,
    "inlineFold.autoFold": true,
  }

REGEX here : https://regex101.com/library/nlSi7u


TODO/ alternative Regex... doing the same with named/aliased wikilinks Exemple : [[this name|gparent.parent.child_name]] -> [[this name]]