Last active
April 28, 2026 11:07
-
-
Save jonathanconway/4f60d4bf2a026c3664ffe57a282e0a00 to your computer and use it in GitHub Desktop.
A11yProject - Scrape checklist items and output as Markdown
This file contains hidden or 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
| /* | |
| * Source: https://www.a11yproject.com/checklist/ | |
| * | |
| * Output: | |
| * | |
| * #### Accessibility - Content | |
| * | |
| * - [ ] Use plain language and avoid figures of speech, idioms, and complicated metaphors.<br />[Article: WCAG - 3.1.5 READING LEVEL](https://www.w3.org/WAI/WCAG22/Understanding/reading-level.html)<br /> #nfr--accessibility #accessibility--content | |
| * - [ ] Make sure that <code>button</code>, <code>a</code>, and <code>label</code> element content is unique and descriptive.<br />[Article: WCAG - ](https://www.w3.org/WAI/WCAG22/Understanding/info-and-relationships.html)<br /> #nfr--accessibility #accessibility--content | |
| * | |
| * ... etc ... | |
| */ | |
| Array.from(document.querySelectorAll("[data-checklist-category]")).map((section) => { | |
| const sectionTitle = section.querySelector("h2").textContent; | |
| const sectionChecklistItems = Array.from(section.querySelectorAll(".c-checklist")).map(s => { | |
| const sectionItemContent = s.querySelector(".c-checklist__title").innerHTML; | |
| const sectionItemLink = s.querySelector("a.c-checklist__link"); | |
| const sectionItemLinkHref = sectionItemLink.getAttribute("href"); | |
| const sectionItemLinkTitle = sectionItemLink.textContent.split(" ").slice(1).join(" ") | |
| console.log({ sectionItemLinkTitle }); | |
| return ({ | |
| sectionItemContent, | |
| sectionItemLinkHref, | |
| sectionItemLinkTitle, | |
| }); | |
| }); | |
| return ` | |
| #### Accessibility - ${sectionTitle} | |
| ${sectionChecklistItems.map(({ sectionItemContent, sectionItemLinkHref, sectionItemLinkTitle }) => ( | |
| `- [ ] ${sectionItemContent}<br />` + | |
| `[Article: WCAG - ${sectionItemLinkTitle}](${sectionItemLinkHref})<br /> ` + | |
| `#nfr--accessibility #accessibility--${sectionTitle.split(" ").map(part => part.toLowerCase()).join("-")}` | |
| )).join("\n")} | |
| `; | |
| }).join("\n"); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment