created: 20190301104756406
modified: 20190302051325077
tags: links
title: Section Names using ID for internal Links - updated
type: application/x-tiddler
Please don't click here yet
!! Showing internal links within a tiddler.
# Lorem
# Funny Quotes
# Humour
# The End
!! Now how can we access them from outside a tiddler?
!!!1. ''Lorem'' Next Top
<<.lorem>>
<<.lorem>>
!!!2. ''Funny Quotes'' Next Previous Top
There
really
isn't
a
funny
quote
here!
Too
Bad!
!!!3. ''Humour'' Next Previous Top
There
isn't
any
Humour
Either.
This
is
just
a
demo.
!!!4. ''The End'' Next Previous Top
Yes.
This
is
really
THE
END
''Well, almost.''
I'm glad you got this far. Here is the issue. When a link is created using:
`Somewhere`
the HTML produced is:
```
Somewhere
```
Giving: Somewhere
Not exactly rocket science.
However when a link is produced using:
`<$link to="##somewhere">Somewhere$link>`
The HTML produced is:
```
Somewhere
```
Giving what may LOOK similar: <$link to="##somewhere">Somewhere$link>
''But it isn't !!!'' - It has an extra `#`
When you click the link made using `` defined in the tiddler.
But when you click the link made using `<$link ... ` it tries to open the missing tiddler: `##somewhere` because it changed the leading `##` into uri coded `%23%23` and it added another `#` infront of the link.
Now how exciting would it be to be able to tweak the `<$link>` widget to accept for example:
```
<$link to="SomeTiddler" id="#somewhere">SomeTiddler's somewhere section$link>
```
And its actions would be to:
# Open tiddler [[SomeTiddler]]
# Do the same action within the tiddler as clicking: `Somewhere` which would be to scroll to the HTML tag within the tiddler defined as: ``
And YES - that `##` used in the `href` attribute just above is the correct syntax, as well as the single `#` used in the `id` attribute.
!!''The Very End''
Previous
Back to the Top!