gddocs icon indicating copy to clipboard operation
gddocs copied to clipboard

Fix links to missing pages and invalid links

Open xparadoxical opened this issue 1 year ago • 2 comments

Using sourcegraph.com with the query context:global repo:^github\.com/Wyliemaster/gddocs$@master file:\.md \[[^\]]+\]\([^\)]*\) and the following JS trickery

const blob = "/-/blob/";
const docs = "docs/";
const branchPermalink = "https://github.com/Wyliemaster/gddocs/blob/1e9c45e7170ab0af9722278b97dd97bec3631dc5/"; //master

for (let header of document.querySelectorAll('article [data-testid="result-container-header"] > span:first-child')) {
    let href = header.firstElementChild.firstElementChild.children[2].href;
    let repoFilePath = href.substring(href.indexOf(blob) + blob.length);
    let docsLocation = repoFilePath.substring(repoFilePath.indexOf("/") + 1);

    header.innerHTML += `<a href="https://wyliemaster.github.io/gddocs/#/${docsLocation}">Open gd docs</a>`;
    header.innerHTML += `<div style="padding-left: 0.5em; cursor: pointer;" onclick="navigator.clipboard.writeText(&quot;${branchPermalink}${repoFilePath}?plain=1&quot;)">Copy GH link</div>`;
}

then by checking everything manually, I compiled a list of broken links:

  • all links to /topics/encryption/gjp.md - it's been moved to /topics/gjp.md
  • all links to enumerations.md - it's missing 🤔 but probably it's to-be-added
  • https://github.com/Wyliemaster/gddocs/blob/1e9c45e7170ab0af9722278b97dd97bec3631dc5/docs/endpoints/levels/getGJLevels21.md?plain=1#L16
  • origin's website is dead https://github.com/Wyliemaster/gddocs/blob/1e9c45e7170ab0af9722278b97dd97bec3631dc5/README.md?plain=1#L13
  • https://github.com/Wyliemaster/gddocs/blob/1e9c45e7170ab0af9722278b97dd97bec3631dc5/docs/endpoints/comments/deleteGJAccComment20.md?plain=1#L13
  • https://github.com/Wyliemaster/gddocs/blob/1e9c45e7170ab0af9722278b97dd97bec3631dc5/docs/endpoints/levels/getGJLevels21.md?plain=1#L10-L11
  • #demonFilter gets lowercased in the compiled version of the website, so this link does not scroll to the dropdown with demonFilter values https://github.com/Wyliemaster/gddocs/blob/1e9c45e7170ab0af9722278b97dd97bec3631dc5/docs/endpoints/levels/getGJLevels21.md?plain=1#L21
  • https://github.com/Wyliemaster/gddocs/blob/1e9c45e7170ab0af9722278b97dd97bec3631dc5/docs/endpoints/levels/getGJLevels21.md?plain=1#L116-L123
  • if these should be links at all, they should link to the section below https://github.com/Wyliemaster/gddocs/blob/1e9c45e7170ab0af9722278b97dd97bec3631dc5/docs/resources/client/gamesave/kCEK.md?plain=1#L8-L9
  • https://github.com/Wyliemaster/gddocs/blob/1e9c45e7170ab0af9722278b97dd97bec3631dc5/docs/resources/client/gamesave/kCEK.md?plain=1#L23
  • the uppercase C makes this link invalid for some docsify reason https://github.com/Wyliemaster/gddocs/blob/1e9c45e7170ab0af9722278b97dd97bec3631dc5/docs/resources/client/level-components/capacity-string.md?plain=1#L101
  • https://github.com/Wyliemaster/gddocs/blob/1e9c45e7170ab0af9722278b97dd97bec3631dc5/docs/resources/client/level-components/guideline-string.md?plain=1#L4
  • all in docs/resources/client/level-components/inner-level-string.md
  • docs/resources/client/level-components/level-colors.md L42 (HSV) links to resources/client/level-components/level-object.md?id=object-string which links to... nothing.
  • https://github.com/Wyliemaster/gddocs/blob/1e9c45e7170ab0af9722278b97dd97bec3631dc5/docs/resources/client/level-components/level-object.md?plain=1#L7 https://github.com/Wyliemaster/gddocs/blob/1e9c45e7170ab0af9722278b97dd97bec3631dc5/docs/resources/client/level-components/level-object.md?plain=1#L41 https://github.com/Wyliemaster/gddocs/blob/1e9c45e7170ab0af9722278b97dd97bec3631dc5/docs/resources/client/level-components/level-object.md?plain=1#L76 https://github.com/Wyliemaster/gddocs/blob/1e9c45e7170ab0af9722278b97dd97bec3631dc5/docs/resources/client/level-components/level-object.md?plain=1#L83-L84 https://github.com/Wyliemaster/gddocs/blob/1e9c45e7170ab0af9722278b97dd97bec3631dc5/docs/resources/client/level-components/level-object.md?plain=1#L89
  • https://github.com/Wyliemaster/gddocs/blob/1e9c45e7170ab0af9722278b97dd97bec3631dc5/docs/resources/client/level-components/color-string.md?plain=1#L24
  • https://github.com/Wyliemaster/gddocs/blob/1e9c45e7170ab0af9722278b97dd97bec3631dc5/docs/resources/server/song.md?plain=1#L8
  • https://github.com/Wyliemaster/gddocs/blob/1e9c45e7170ab0af9722278b97dd97bec3631dc5/docs/resources/client/level.md?plain=1#L41 https://github.com/Wyliemaster/gddocs/blob/1e9c45e7170ab0af9722278b97dd97bec3631dc5/docs/resources/client/level.md?plain=1#L48
  • https://github.com/Wyliemaster/gddocs/blob/1e9c45e7170ab0af9722278b97dd97bec3631dc5/docs/topics/status_codes.md?plain=1#L11 https://github.com/Wyliemaster/gddocs/blob/1e9c45e7170ab0af9722278b97dd97bec3631dc5/docs/topics/status_codes.md?plain=1#L62
  • https://github.com/Wyliemaster/gddocs/blob/1e9c45e7170ab0af9722278b97dd97bec3631dc5/docs/topics/tags.md?plain=1#L40
  • "gzip" is a link to zlib.net in all other places, except here https://github.com/Wyliemaster/gddocs/blob/1e9c45e7170ab0af9722278b97dd97bec3631dc5/docs/resources/client/gamesave.md?plain=1#L5
  • this should not be a link https://github.com/Wyliemaster/gddocs/blob/1e9c45e7170ab0af9722278b97dd97bec3631dc5/docs/_sidebar.md?plain=1#L3
  • while we're at it, dots are not needed in all the links in /docs/endpoints/levels/uploadGJLevel21.md and in this link https://github.com/Wyliemaster/gddocs/blob/1e9c45e7170ab0af9722278b97dd97bec3631dc5/docs/resources/client/level.md?plain=1#L17

I could've saved so much time if I'd automate this by reading markdown links in files... . . . . . .  .  .   .     .      .

xparadoxical avatar Jun 08 '23 00:06 xparadoxical