obsidian-digital-garden
obsidian-digital-garden copied to clipboard
Heading links do not remove the hashtag character
If you have a link to a heading in a document such as the following:
[[#heading]]
Then it renders as #heading instead of heading.
I'm not sure what the expected behavior is but I did create a test page to play with this.
https://hive.mod0.org/tech/obsidian/test-heading-links/
I rarely use these features in Obsidian and so don't have many opinions, especially for how it should work in a Digital Garden website context. I thought having a recent rendering of current behavior might assist in clarifying the issue here.
@ThatOtherAndrew, can you provide more details that might lead to a feature request or bug report? Otherwise, in a quest to help reduce open issues for this epic tool, we consider closing this issue.
Context: I'm just a fan/user of this tool who cares about long-term sustainability of this project so trying to help reduce or clarify the backlog of issues where I can.
I didn't open a new issue because I saw this one, but I believe I can explain it better. Obsidian supports three types of internal links:
[[Other note]]→ works[[Other note#Subtitle]]→ works, links to a specific section of the other note.[[#Subtitle]]→ doesn't work, is supposed to link to a different section of the file you're currently in.
Actually, the proper link does get created, but it's empty. Here's HTML of my example in which I simply call [[#Positive factors]]:
<p>
<a class="internal-link" data-note-icon="" href="/note-i-m-currently-in/#positive-factors"></a>
<a class="tag" onclick="toggleTagSearch(this)" data-content="#Positive">#Positive</a> factors
</p>
So instead of linking to a section in the file named "Positive factors", it:
- Creates an empty (but currect) link.
- Interprets "#Positive" as a tag and links to a search.
- Interprets "factors" as just a normal text.
A workaround I found is to use the longer version ([[Note I'm currently in#Positive factors]]), which is a bit annoying but it does work.
I believe that src/helpers/linkUtils.js in the template doesn't account for links beginning with a hashtag, but I don't know if that's the only thing it's missing, some change might be needed in the extension as well.
Sorry, I realise how rubbish my issue was! What @inputsh said is spot on.
Still there and still is a problem. Instead of link to the heading a link to a tag is created.
I previously saw this issue after an update [#411] and never managed to get it to go away in the subsequent updates. I re-did my stactic layout and switched over to Vercel, thinking that a fresh start might solve my 404 pages issue, but it looks like it is still going strong — including all of the links-to-subheaders that used to work now being broken as well.