simov / markdown-viewer

Markdown Viewer / Browser Extension
MIT License
1.05k stars 133 forks source link

Section link across page doesn't work #114

Closed Kimi-Arthur closed 1 year ago

Kimi-Arthur commented 4 years ago

This is what I observed: If there is a link to another local md file with section title, like [text](../some_file.md#section-1), it will open it, but won't scroll to the position. And if you modify the current url to Section-1, it will scroll there. Capitalisation is not the problem, it's just another url for the section.

Also, if I'm opening the same page in another tab with a new section id, it won't scroll (it will stick to the old location).

What I guess: When the page first loads, there is no such an id like section-1, as maybe the extension hasn't processed the page yet. However, after the page loads and I change the url in the same tab, the page knows that id and will scroll.

simov commented 4 years ago

Thanks for the detailed bug report, I'll have a look :+1:

Reissner commented 4 years ago

I wonder how local links work: text ok, but how to set the destination? html style with does not work, also

title {#xxx} is interpreted verbatim.

I miss that aspect in the documentation. If i dont know how it should work by intention, i dont know whether it is ok.

Kimi-Arthur commented 4 years ago

I think this extension generates the id for each section title automatically, which is pretty nice and works if referenced in the same page.

simov commented 1 year ago

The autoscroll behavior was updated in v5.1 Now the extension either scrolls to the last known position in the page or to a header if a hash fragment is present in the URL. I'm closing this issue for now, but let me know if that works for you.