Skip to content

Instantly share code, notes, and snippets.

@sayjeyhi
Created September 10, 2020 17:37
Show Gist options
  • Save sayjeyhi/267c7cacb6b4e881155062451a66afb6 to your computer and use it in GitHub Desktop.
Save sayjeyhi/267c7cacb6b4e881155062451a66afb6 to your computer and use it in GitHub Desktop.
// get table of contents and apply answer link on them
html = html.replace(
/<td><a \S+=["']?#((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?.*>(.*)<\/a><\/td>/gm,
(whole, p1, p2) =>
`<td id="${makeUrl(p2)}-q"><a class="fehrest" href="#${makeUrl(
p2
)}">${p2}</a></td>`
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment