Skip to content

Instantly share code, notes, and snippets.

@sayjeyhi
Created September 10, 2020 17:36
Show Gist options
  • Save sayjeyhi/56b2fbe85e15ffd53b34aa89e9f1a888 to your computer and use it in GitHub Desktop.
Save sayjeyhi/56b2fbe85e15ffd53b34aa89e9f1a888 to your computer and use it in GitHub Desktop.
// back to top links fix
html = html.replace(
/<strong><a \S+=["']?#((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?.*>(.*)<\/a><\/strong>/gm,
(whole, p1, p2) =>
`<strong><a class="backToTop" href="#${makeUrl(
p2
)}-q">${p2}</a></strong>`
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment