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