-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug in location hash processing loses any characters after second # #3811
Comments
@00SS would you be interested in making a PR for the required documentation? We'll need to both document the behaviour and how it can be used in practical terms, along the lines of your post. |
@Jermolene |
😁 👍 |
Thanks @00SS |
Just as an interesting note, if the underlying HTML is inspected, this code produces the same HTML as using the
gives:
The documentation though clearly points out:
|
I am working on the documentation and put in some posts on the same Google Groups discussion: Section Names using ID for internal Links I wanted to see what feedback is received before making the pull request for documenting this. For the record, I am attaching the 2nd draft (below) - which can also for now be seen here: Internal Links using HTML Attached tiddler: Internal Links using HTML - updated 1.tid.txt |
A new tiddler documenting the process for creating anchors and using links for sub-tiddler navigation. Arising from issue TiddlyWiki#3811 & Discussed on Google Groups: [Section Names using ID for internal Links](https://groups.google.com/forum/?hl=en#!topic/tiddlywiki/ikjxwjllFtE)
Is it possible to modify the current |
I also thought about this, but since the |
With respect to @00SS's comment above about the @twMat I don't see a way we can easily reuse the <$link> widget to make links to anchors. |
For the record, so my main point is not missed : There is a problem to expect/instruct TW users to have to learn html for such a basic thing as creating links. Of course, html is better than no solution at all but my hope is that this discovery should be "tiddlified" and not force users to go outside of wikitext. I feel I'm stating the obvious here had it not been for the fact that fellow @00SS is putting a lot of great work into documenting this as a html solution. Or, @Jermolene , is it not possible to "embed" this discovery into wikitext at all? |
I agree with you @twMat There are still some as yet unexplained issues that come up - such as some browsers not accepting URI encoded id attributes as anchors. And also, on and off, (I estimate 1 out of 4 times) when I have made changes to an id or link in the DOC tiddler or reload TiddlyWiki after changes, the first click on an anchor link just goes to the top of the Story, but after that, every anchor link click works perfectly. So maybe before a WikiText solution is designed, we can put up the HTML way of doing it for some months and see what problems and requirements arise so that we can have a robust WikiText solution. |
I think I will put a stronger discouragement message for an |
To make a note of previous discussions and ideas: Reading this Github post in issue #1783 led me to: scroller.tiddlyspot.com which uses In that custom modified TiddlyWiki, in a tiddler TiddlerTitle, defining a The WikiText to open the closed tiddler and scroll to the Heading is: I believe also that scroll to align the top/left of the target element with the top/left of the viewport is another piece of the puzzle in place. A way to stop the URL in the bar being updated might be found here: intlinks.tiddlyspot.com @twMat also mentions another a new possibility on Issue #1783 |
Apologies for the delay from my side. I hope to get around to completing this soon. |
@Jermolene wrote:
While the side effect (allowing double-hash values to be treated specially) is interesting and probably worth preserving, I think there's also a strong use case for fixing this bug, because there will definitely be people who write tiddlers with titles like "Meeting #1 on October 20", which could then trigger the bug if the tiddler title somehow failed to get URL-escaped. Note that it would not work to simply do But this bug can be solved very easily by using |
@Jermolene PR #4947 would fix the bug for tiddler titles like "Meeting #1 on October 20", while still preserving the desired behavior of allowing double hashes like |
Looks like #3836 was a good PR for documenting this behavior. It was ultimately closed, but I think I'll revive it at some point. In the Google Group there was also another piece of documentation contributed by Watt, which I also think is worth preserving in case it's better for the PR. I'm going to attach both of those documents to this issue until I can find the time to create a PR. Both of those look good at first glance, though whoever does this PR (whether that's me or someone else) will have to read through them and make sure they are still up-to-date for 5.1.23, or update them if any recently-added features mean the docs need a change or two. (Note to self: #3767 and #3926 are also worth looking at when writing the documentation PR). |
Thanks @rmunn I think this is a reasonable fix |
Thanks @rmunn |
@00SS discovered an interesting bug that has been in TW5 since 2014: the following code is used in boot.js to read the location hash (the portion of the current URL from the first
#
character):The bug occurs when the location hash contains more than one
#
character. For examplehttps://tiddlywiki.com/#Foo#Bar
would be split intohttps://tiddlywiki.com/
,Foo
andBar
. The first string is thrown away and the second string is returned as the location hash, discarding the final string. This means that it is impossible to use a permalink to a tiddler that includes a#
character. In practice, permalinks are supposed to escape#
to%23
(and the permalinks generated by TiddlyWiki itself use this encoding), so I suspect that nobody has ever encountered this bug in the field.It's easy enough to fix the bug, but @00SS also discovered an interesting side effect of the bug: navigating to a location hash that starts with a
#
character will not trigger TiddlyWiki's own navigation processing, but leave the underlying browser processing intact. This enables anchors to be used within tiddlers for sub-tiddler navigation.So, rather than fix this bug, I propose to document the behaviour of double hash location hashes.
The text was updated successfully, but these errors were encountered: