Created
November 23, 2021 21:56
-
-
Save eps1lon/9a58851a28c5b5bc60e5240f0af25d23 to your computer and use it in GitHub Desktop.
get all Success Criteria as linked markdown headings
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 headings = Array.from(document.querySelectorAll('h1, h2, h3, h4, h5, h6')) | |
const scHeadings = headings.filter(heading => { | |
return /^Success Criterion/.test(heading.textContent) | |
}).map(heading => { | |
return heading.querySelector('a[aria-label^="Permalink"]') | |
}) | |
const scMarkdownHeadings = scHeadings.map(e => `### [${e.getAttribute('aria-label').replace(/^Permalink for /, '')}](${e.href})`) | |
console.log(scMarkdownHeadings.join('\n')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment