Add accessible <FileTree> component to replace ASCII art#2178
Merged
Conversation
✅ Deploy Preview for astro-docs-2 ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Member
|
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! 🥳 |
yanthomasdev
approved these changes
Dec 14, 2022
Member
yanthomasdev
left a comment
There was a problem hiding this comment.
Tested with NVDA, it's perfect! Great work @delucis 🙌
delucis
commented
Dec 14, 2022
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
FileTreecomponent into your file, authoring looks like this:**index.astro**.astro.configentry 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.