git-read

Navigate with @hotwired/turbo

The HTML pages output by git-read commands are intended to be served directly, through static site servers like GitHub pages.

Despite the absence of a server-side component, the application’s navigation could still stand to benefit from the value that Turbo proposes:

Turbo bundles several techniques for creating fast, modern, progressively enhanced web applications without using much JavaScript. It offers a simpler alternative to the prevailing client-side frameworks which put all the logic in the front-end and confine the server side of your app to being little more than a JSON API.

Turbo Drive is the part of Turbo that enhances page-level navigation. It watches for link clicks and form submissions, performs them in the background, and updates the page without doing a full reload. It’s the evolution of a library previously known as Turbolinks.

To integrate with Turbo, modify existing [event listeners][] that are firing callbacks for the DOMContentLoaded event declared on the page’s document, replacing them with event listeners on the turbo:load event.

Scroll current Commit into view

When navigation to a commit completes, scroll that commit’s node in the history navigator into view.

When the browser finished loading and parsing the page’s necessary assets and elements, it fires a turbo:load event on the document object.

When the browser finalizes loading and parsing its contents, scroll any descendant elements annotated with the [aria-current="page"] attribute into view my invoking the .scrollIntoView() method directly on the elements. Invoking .scrollIntoView() upon turbo:load will improve the visibility of any [aria-current] elements present on the page.