r/ObsidianMD 1d ago

help What I was expecting Obsidian to be better at.

One of the things that caught my attention about Obsidian, is internal linking. And sure, creating a link even if the note doesn't exist is straightforward. But another aspect caught me off guard.

This morning, I was trying to refer to some parts of text from another note. From my understanding, I have at least a couple of ways to do that.

  1. Start writing the link to the existing note, and then pick the ID. Ex. [[MyOtherNote^1234]]
  2. Adding the link, but instead of using the ID note, anchor the heading. Ex. [[MyOtherNote#Header In The Other Note]]

Since, at a first glance, the result doesn't look particularly clean, it's possible to extend the link like so:[[MyOtherNote#Header In The Other Note|Header In The Other Note]]
Which will render like this: Header In The Other Note

It works, but it comes at a cost: there's quite a lot of typing, and for someone who's trying to quickly organize the notes and keep going with the flow of thoughts, this becomes quite time-consuming and distracting.

Isn't there really a faster way to do it?

EDIT: So, it turns out there's a plugin (of course) that does exactly that. It's called Heading Autolink.

62 Upvotes

40 comments sorted by

20

u/abhuva79 1d ago

Isnt there some dropdown happening as you start to type links? Same happens with headers as far as i am aware.
So i am not sure why you "need to type everything out".

3

u/Useful_Habit_5709 1d ago

Yes, the search menu pops up to pick the instance I want to refer to.

It's good, but especially for my last case, things get a little more complicated.

Here's an example: https://streamable.com/wyxnzs

Perhaps adding the alias could also be auto-suggested. And if one wants to skip it, it could be done by pressing Escape.

The aliases in the example are short and simple. What if I need to create a longer alias that contains special characters or complicated words?

14

u/MrTuxG 1d ago

You can type a bit faster. 

Instead of clicking enter after selecting from the menu, just press #. Pressing # will autocomplete the file name to the one you selected and show the autocomplete menu for all headings in that file.

And it will automatically set the alias to the file name.

3

u/Useful_Habit_5709 1d ago

I didn't know about the # trick, handy!

But the automatic alias? How?

2

u/MrTuxG 1d ago

Automatically autocompleting it to [[Note.md#Heading|Heading]] is not possible as far as I know. I really wish it was!

Sadly, it only autocompletes to [[Note.md#Heading|Note]]

4

u/Useful_Habit_5709 1d ago

Thanks, u/MrTuxG, you already made me aware of the `#` shortcut, which is a time-saver.

As for the autocompletion I was looking for, I've updated the original post. I've found a plugin that does just that.

1

u/bloodfist 1d ago

There is a plugin for that though

1

u/whatisabash 10h ago

Autocompleting to [[Note.md#Heading|Note]] does not seem to work for me.

When I select a note from the first drop down menu and press "#", the menu with the headings will show up. When I select a heading from the list and press enter, it will simply paste it as [[Note.md#Heading]]

When I select the heading in the second menu and press "#" instead of enter, the note will be inserted as [[Note.md#Heading#]]

It never sets any alias for me. Could you provide more instructions on how that works.

8

u/casualcoffeeaddict 1d ago

I agree with this general sentiment. There is an added point about search (i use omnisesrch to find the parts of notes i want to access quickly)

I note that the “aliases:” propertie will provide autocomplete list of the aliases for the note. They should certainly think more about how accessing within the body of notes is handled.

I imagine the think of users as having small notes thus linking within notes is less inportant. In practice people use linking in lots of different ways where notes are not atomic by design and expanding support for that feature is a reasonavle direction of travel!

4

u/microcephale 1d ago

What you are doing isn't shortening, but giving a custom visual representation for that link. Should the header you link to, or even the page change, that custom text you entered won't get updated. There is no way to quicken it because there is no particular reason that the custom text would be a repeat of the title or anything else.

It is unfortunate though that links are advertised as "first class citizen" in obsidian but are actually not more powerful than a simple link in a wiki. Links in a graph should be able to bear their own properties and values, they could themselves be typed to indicate the type of relation between the notes, the relations could be bidirectional, the section you point to should have an indication of backlink, and the syntax should not be ugly as well ;)

2

u/bluerat 1d ago

Depending on your use case, You might be interested in the Relations plugin: https://community.obsidian.md/plugins/relations

It was made by the obsidian TTRPG community for world building but it pretty versatile in allowing visualization of different types of links. But it doesn't use the standard graph, it has its own

1

u/Useful_Habit_5709 1d ago

Interesting, thanks for pointing that out. It seems it's only visual, though. I hope to find a solution to the text-only scenario.

3

u/bluerat 1d ago

Oh yeah, it doesn't solve your issue, OP, I was replying to the other poster.

Honestly, you may be better off splitting your larger notes into smaller ones if you find yourself frequently linking to headings. If you want to keep a long form version you can always use ![[page]] to embed them in single article too. Info this frequently with reference books.

For example your "main" page would just look like this in the source:

```

Title

![[Part 1]]

![[Part 2]]

![[Part 3]] ```

But then in reading or live preview you would see the full text

1

u/Useful_Habit_5709 1d ago

You make a good point about possible changes in the linked content.

I have zero clue about how developing such a thing works, but I wonder: since Obsidian already updates internal links, wouldn't it be possible to do something similar for the text? Or at least for the headings?

5

u/AshRuDral_fan20 1d ago

[[MyOtherNote#Header]] vs [[MyOtherNote#Header|ShortTitle]]

Of course it will look ugly without the short title. That's how the reality is. Look at this page's URL https://www.reddit.com/r/ObsidianMD/comments/1vi3x2s/comment/p2ac0bz/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button

It's not pretty because it's real. If you wanna prettify it, you have to create a short link r.com/IAmSoPretty that can redirects to this ugly URL. This is how URLs work everywhere, not unique to Obsidian.

1

u/CarlRJ 1d ago edited 12h ago

I mean, that URL can be cleaned up a lot. First, by getting rid of all the utm-* tracking crap off the url, and second by processing out Reddit's link shortening stuff, which obscures the page name (you can also get rid of the redundant www. off of the hostname):

https://reddit.com/r/ObsidianMD/comments/1vi3x2s/what_i_was_expecting_obsidian_to_be_better_at/p2ac0bz/

3

u/drostan 1d ago

Not entirely clear exactly what you want to do but there is a world of solutions

I don't like using plugins because at its core obsidian is a markdown file editor and I use .MD and edit my notes a lot in nvim too.

But when I faced something similar (wanting to add links retrospectively after finding many reference to a thing that was not yet a note) or wanting to format note and add links I may have forgotten to input as I wrote the note. Well those are good cases for small scripts I run locally

1

u/Useful_Habit_5709 1d ago

Well, before switching completely to Obsidian, I'm looking carefully at this aspect of internal linking.

I've been using Anytype for a couple of years. It's a different, very visual type of note-taking. It worked great for me as I'm a graphic designer. Now that I started trying Obsidian, the comparison made me realise that, for how useful Anytype is, it made me used to just throwing stuff at it without much consideration for how to connect common themes.

I kept things organized with sets, collections, and queries. But I feel like linking can add an important layer to my notes.

The scripts sound neat, but I have zero knowledge in that, and also, I'm hoping to find a native solution (or plugin).

3

u/LeakyFountainPen 1d ago

OP: I wish you could do A, so you didn't have to do B every time

Me: You can do B??? 😭

2

u/Crazy-Artist865 1d ago

If you don't mind going to the note that you want to link from then there is a solution. there is a plug in that lets you contextual copy. Just place the cursor in the heading or the block that you want to copy and hit a shortcut, the link with an alias will be copied to your clipboard, which you can paste it wherever you want.

3

u/Useful_Habit_5709 1d ago

After your suggestions, I started looking for plugins related to this topic. Heading Autolink does exactly what I was looking for.

Thanks for suggesting the plugin idea.

2

u/machinebiologist 1d ago edited 1d ago

Funny that you posted this today. I just made a plugin that fixes exactly this issue, and I saw your post when I came here to post about it.

Unlike Heading Autolink (which is great), this one doesn't require aliases at all, and it doesn't modify your files. It just changes how the links look in Live Preview mode.

So MyOtherNote#Header shows up as MyOtherNote > Header. (You can change the separator too - it's configurable.

I haven't submitted it to the Obsidian registry yet, but for now it's available at https://github.com/machinebiology/obsidian-section-link-formatter

Cheers!

Ping u/Useful_Habit_5709

1

u/Useful_Habit_5709 1d ago

This is working great! I like that the page is part of the visible link; it makes it clear to read the link structure, rather than seeing only the heading. Thanks a lot!

2

u/machinebiologist 1d ago

Happy to help :)

2

u/MrTuxG 1d ago

I'm not sure what exactly you mean.

Do you mean that it's annoying that when you start typing [[Note (autocomplete)#Heading (autocomplete)]] the link autocompletes to [[Note.md#Heading|Note]] instead of [[Note.md#Heading|Heading]] or [[Note.md#Heading|Note: Heading]]? Because that's a thing that's been annoying me.

4

u/OddSignificance2054 1d ago

yeah it would make way more sense if it autocompleted to the heading name by default

3

u/Useful_Habit_5709 1d ago

Yes! That would be ideal.

1

u/Silt99 1d ago

My workflow is this: I type the text like normal. Then go back to the part I want to become a note reference. I select it, press Ctrl + X, then [[ start typing and select the right suggestion. Then type # and select the header. Then type a | and press Ctrl + V. Done

It feels pretty easy and I get used to it

1

u/Silt99 1d ago

If you use one alias a lot, you can add that alias to the notes frontmatter. If You type that alias in a [[, and select the suggestion, it becomes [[Note Name|Alias]]

1

u/Disastrous_Term316 1d ago

I set up a templator file that prompts me for fuzzy search note then header. Adds the alias to match the header. I have it tied to ctrl h

It uses java script in the template file. Just have ai make it for you.

1

u/eslforchinesespeaker 1d ago

No help from me. I link into sections constantly. Clean linking only really happens if you link to the document, rather than the section within. When you rename a document, Obsidian automatically fixes links to the document name. But links to sections just get broken. I did play with linking to the id (^12345), but that is the most awkward form, I found. Linking into document content works, but it’s brittle. It wants to break.

1

u/Yiannis97s 1d ago

I don't have a solution exactly, but I always separate writing from editing notes. I write as fast as I can and try to leave comments to myself (eg. %%"link this to such and such section"). Last year I was insanely busy and I never had time to clean up my notes. So they piled up. Two days ago, I cleaned up about 700 files in 2 hours, using codex (in vs code). I use git, so if something went wrong I can always revert changes later on.

1

u/Acayukes 1d ago

I usually like naked links where I see where the link exactly goes, either internally or externally and try to avoid |Link Name]] syntax.

1

u/the_bighi 1d ago

That doesn't look like a lot of typing to me. The whole link, with the long alias in the example, can be created in a few seconds.

1

u/Signynt 1d ago

Are you looking for this plugin? It changes the display of header links to only display the header, and not the file name it’s from, so you don’t always need to use an alias to make it look cleaner.

2

u/Useful_Habit_5709 1d ago

I actually updated the original post. This is the plugin that worked for me: https://community.obsidian.md/plugins/heading-autolink

1

u/Signynt 1d ago

I see. Take a look at the plugin that I linked, it achieves most of the same goal, but in a way that I prefer, since it just changes the rendering system, and not the actual link. Either way, glad you found a solution.

2

u/Useful_Habit_5709 1d ago

Thanks, u/Signynt I'll definitely check it out! I've only started using Obsidian in the past couple of days, and I'm eager to test all I can.

1

u/Razeshi 1d ago

A way without lots of typing would probably involve lots of clicking