Created
January 18, 2021 20:37
-
-
Save dwsmart/a05e00e8348b129abd3fbf6c2a5cb71b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const currURL = `${window.location.protocol}//${window.location.host}${window.location.pathname}${window.location.search}` | |
let outputString = '' | |
for (var idx in document.links) { | |
const ancString = `${document.links[idx]}` | |
if (ancString.includes('#')) { | |
const anchParts = ancString.split('#') | |
if (anchParts[0] === currURL) { | |
| |
if (!document.getElementById(anchParts[1])) { | |
outputString += `${document.links[idx]}\n` | |
} | |
} | |
} | |
| |
} | |
| |
if (outputString !== '') { | |
const thisComment = document.createComment(`\n+-- Missing Anchors: [\n"${outputString}"] ---+\n`); | |
document.head.insertBefore(thisComment, document.head.firstChild); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment