Last active
September 12, 2019 09:24
-
-
Save NoxWings/c91544ef724bb24a4700c665cfcace69 to your computer and use it in GitHub Desktop.
Having the wiki page list on the home screen has better visibility than having them on the side so this extracts the links and prints the markup to add it to a page
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
// Extract wiki page links | |
function extractWikiPageLinks () { | |
const aNodes = document.querySelectorAll(".m-0.p-0.list-style-none>li a") | |
return Array.from(aNodes).map(aNode => ({ | |
title: aNode.text, | |
href: aNode.href | |
})); | |
} | |
function formatWikiLinks (links) { | |
return links.reduce((str, link) => { | |
str += `* [${link.title}](${link.href})\n` | |
return str; | |
}, ""); | |
} | |
console.log(formatWikiLinks(extractWikiPageLinks())); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment