Skip to content
Discussion options

You must be logged in to vote

Found a solution using monkeypatching (not great, not terrible; gets the job done).

var replaceState = history.replaceState;
history.replaceState = function () {
    const url = location.href
    var section = url.split("#")[1]
    if (section != undefined) {
        console.log(`TOC section changed: ${section}, url: ${url}`)
    }
    replaceState.apply(history, arguments);
};

Lessons learned from this experiment in case it's helpful to anyone else:

Replies: 6 comments 7 replies

Comment options

You must be logged in to vote
4 replies
@heitorlessa
Comment options

@squidfunk
Comment options

@heitorlessa
Comment options

@squidfunk
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@squidfunk
Comment options

Comment options

You must be logged in to vote
2 replies
@squidfunk
Comment options

@heitorlessa
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by heitorlessa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #3537 on February 04, 2022 16:07.