-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add accessible <FileTree>
component to replace ASCII art
#2178
Conversation
✅ Deploy Preview for astro-docs-2 ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Super excited for this @delucis! I tested all the docs pages, at various screen sizes and on my phone, and it all looks AMAZINGLY good to me! 🥳 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so cool!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with NVDA, it's perfect! Great work @delucis 🙌
Summary
<FileTree>
component to render file hierarchies in a more accessible manner than the ASCII art we use currently. Also in a fancier manner:Authoring
Once you import the
FileTree
component into your file, authoring looks like this:**index.astro**
.astro.config
entry above.Screenshots
Here’s a before/after from the manual install guide:
How does this work
The
<FileTree>
component expects to be passed an unordered list. It passes this list through a rehype pipeline that wraps directories in a<details>
element to make them collapsible.Each filename is passed to a utility based on the Seti UI VS Code icon system to get an icon for the detected file type. This is injected as an inline SVG.
This pipeline also separates the comments and interprets the bold filename as highlighted.