Linking documents in HTML

Things I have tried

I have searched the forums and online, and the only relevant thing was about relative image links, which did not describe how to make it work, even absolute.

What I’m trying to do

I’m trying to create centered text with a link to a note, and can’t figure out how to do so.

Centering works like this: <p style="text-align: center;">Text</p>, but of course you can’t embed Markdown links in HTML. So how do I link to another note? Or is there a better way to do this?

How about …

  1. Create a css snippet for a class:
.center-link { display: block; text-align: center; }
  1. In the note use
<span class="center-link">[[TEXT]]</span>

Or has to be HTML?

Markdown doesn’t work inside HTML, as mentioned in the original post.


Here’s the answer that worked for me:

<span style="display:block;width:fit-content;margin:auto;">[[Note link]]</span>

Now, this just shows up as code in Live Preview, but then again so does <p style="text-align: center;">Text</p>.

Thanks, Discord!

Do you mean that the solution I offered doesn’t work? For me, it works the same as the OP’s solution listed in this thread: in Live Preview you see …

[[Link Text]]

… and in Reading View you see a clickable / functioning link.

That’s what I meant, because I didn’t know working that way was an acceptable solution to OP until they posted it. :slight_smile:

1 Like

Many thanks for the reply: helps me to understand things more clearly. Either solution is a kludge, but they just about work. :partying_face:

I didn’t think to mention, you could use an HTML link with an Obsidian URL, which will also work in Live Preview. <a href=“obsidian://open?vault=notes&file=22.Log%2F2022%2F2022-09-02”>like so</a>

1 Like

Ah! That is the kind of thing I was looking for to begin with. How awkward!

But the tag works fine for my purposes.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.