Skip to content

Instantly share code, notes, and snippets.

@eps1lon
Created November 23, 2021 21:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eps1lon/9a58851a28c5b5bc60e5240f0af25d23 to your computer and use it in GitHub Desktop.
Save eps1lon/9a58851a28c5b5bc60e5240f0af25d23 to your computer and use it in GitHub Desktop.
get all Success Criteria as linked markdown headings
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