How to insert an internal link in an org roam note?

I want to add an internal link to a section inside an org roam note.
The problem is that when I put the cursor on the link emacs thinks I want to create a new org-roam note.
So I guess this is not the proper way to insert an internal link. How should I do it?

MWE:

* Section 1
:PROPERTIES:
:CUSTOM_ID: my_custom_id
:END:

* Section 2
see section [[#my_custom_id]]
1 Like
  1. Place the cursor over * Section 1
  2. C-c L to label the the section. A :PROPERTIES: drawer will appear along with a generated id.
  3. Copy the id
  4. where "see section [[#my_custom_id]] instead, C-c C-l and select id: and paste the id.
    org-toggle-link-display shows the link as [[id:f27926b3-0333-4233-9c96-4d716d1fb5ee]] in my case.
  5. This link will work on any file, the same one and outside files.
1 Like

Thanks!

Isn’t there a way to use some informative name for the label (i.e. the custom_id)?

@roi.holtzman
I do not know a way to use the custom_id property, but quick three examples to use the heading itself within a note:

The first example is a plain Org Mode’s capability, I think (I believe it’s called “fuzzy link”).

The second is an Org-roam capability.

The last example looks to be a bug (the asterisk “*” should be inserted after “roam:” to be the same as the second example – not reported yet, I don’t think).

I believe if you want also a backlink for the heading, then you would need the ID property for the headline (but that does not seem to be what you are going for).

Here is the relevant Org-roam manual page.

3 Likes

Do you need to set something in order for that to work? I don’t have that functionality in my setup for some reason.

org-link

Try Company mode.
I believe this post gives you some direction. You can jump to the section named “Configuration”.

1 Like

This is now fixed. Lightening speed (:zap: :zap:), @jethro, thank you.

1 Like

How do you set the double bracket [[link here]] to stay there after the cursor goes out?

Like in the demo? That’s the standard behavior of Emacs I think. I don’t configure anything for that.

Oh wait. What do you mean? You are not talking about cursor?

org-toggle-link-display or something. It’s a command (function that you can call interactively)

1 Like

Great! thanks!

When I put a link and the cursor is before the closing brackets [[link|]] (in the | sign), then TAB does not take me out of the link.
Do you have the same behavior?

I use org-cdlatex which might cause problems here…

1 Like

Same in my Emacs.

I think that is deliberate design choice.
I asked Jethro (believe it was somewhere in the forum); you may want to follow the link by a “*” to further look for a headline within the note, like this: [[link*headline]] That’s why the cursor remains inside the bracket. I usually use C-e to get out as a link is almost always (for me) at the end of the line I am writing (because I’m in the middle of the writing).

Dear nobiot,
Please check this link !
I can not open this [ Org-roam manual page ], yet.
Yours, WAKAMATSU

It’s probably easy for you to do the following:

  1. Refer to the manual in Emacs (C-h i)
    If you are on Windows and use Doom, you may not easily have the in-system manual, if so, consider Option 2 below.
  2. Go to Org-roam User Manual, and find the page
    Search for the term you are looking for