naturalcrit / homebrewery

Create authentic looking D&D homebrews using only markdown
https://homebrewery.naturalcrit.com
MIT License
1.03k stars 316 forks source link

Provide a Linkable URL to ID Heading #3505

Closed mouse0270 closed 3 weeks ago

mouse0270 commented 3 weeks ago

Your idea:

So I am sorry for posting this as I am pretty sure this is a duplicate of issue #3272 however, the linked issues saying this is being resolved are closed #1923 and #3262

But I am trying to find a way to link to either a specific page or a specific heading within a shareable link. For example, using this Brew: Fallout TTRPG by The Arcane Arcade I thought it would be useful to be able to provide links to users such as

so that users can click these links from outside sources and go to that specific page or that specific ID. However, even though linking to #WEAPON_MOD_PROP_POWERFUL appears to work while the document is loaded, it does not work when the user clicks a url and comes to the brew. Instead, it just keeps the user on the first page.

My assumption is because when the page loads, the pages have not been loaded yet, so the browser does not know where to direct the user to as that heading does not exist.

My request is, would it be possible to link players to an ID from the URL after the Global Headings have been registered. So, after a page loads and all headings are registered you check the URL and if there is a #ID at the end of the URL, you jump to that Heading if it exists?

5e-Cleric commented 3 weeks ago

actually, this is a duplicate of #2820 which is not possible at this time, we'd need to create a function to check the url for the specific id handler and then scroll the iframe that contains the document to the desired heading... Will take a look at this, but i can't promise anything at this time.

5e-Cleric commented 3 weeks ago

Just pushed a PR that should enable this. Closing as duplicate, all further discussion will be held at #2820