billstclair / xossbow

Xossbow is to blogging what Crossbows are to bows. Made with Elm.
http://Xossbow.com/
MIT License
3 stars 0 forks source link

Permalinks #9

Open billstclair opened 7 years ago

billstclair commented 7 years ago

Web browsers have a bad habit of going to the server whenever anything but a hash changes (example.com#hash). Hashes are interpreted as scrolling to an anchor tag with a matching name:

<a name='hash'>...</a>

In Elm, we've got to keep the same base URL, and search string, or the server will restart our code, which makes for a startup transient, especially if the caches aren't fresh. So I'll address pages with just hash changes:

https://Xossbow.com#about

And, in order to ALSO use the browser's name scrolling feature, the hashes can have an additional dotted component:

https://Xossbow.com#docs.Settings

This will require another Markdown extension to automatically generate named links for headings, and to be able to specify your own named links, with a way for user-code to add a wrapper around the tags that are automatically generated, so that Xossbow can change the output for:

*** Settings

Which would normally generate:

["a",{"name":"Settings"},
  ["h3",{},
    ["Settings"]
  ]
]

to:

["a",{"name":"docs.Settings"},
  ["h3",{},
    ["Settings"]
  ]
]
billstclair commented 7 years ago

I fixed the basic part of this in 6a2c31cb80c804bfa887fe88ffb037d6209ca56b. Still need to do the names.