Skip to content
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

New list type: File tree #7761

Open
4 tasks done
ofek opened this issue Nov 28, 2024 · 6 comments
Open
4 tasks done

New list type: File tree #7761

ofek opened this issue Nov 28, 2024 · 6 comments
Labels
change request Issue requests a new feature or improvement

Comments

@ofek
Copy link
Collaborator

ofek commented Nov 28, 2024

Context

https://squidfunk.github.io/mkdocs-material/reference/lists/

Description

It would be nice to offer a way to display a directory-like structure.

Related links

https://starlight.astro.build/components/file-tree/

Use Cases

This would solve the issue of displaying how a folder should be structured without manual formatting or manual local creation in order to run the tree command which requires special flags and is not available on Windows. The second approach also doesn't give you icons for different extension types unless you set up your terminal with Nerd Fonts and sometimes those do not copy/paste well.

Visuals

image

Before submitting

@squidfunk
Copy link
Owner

Thanks for suggesting. I'm not sure how many users would need this, and how the syntax/markup for this would look, but we can leave it open for a while to see if others would find it useful as well.

@squidfunk squidfunk added the change request Issue requests a new feature or improvement label Nov 28, 2024
@zanieb
Copy link

zanieb commented Dec 6, 2024

I haven't ever wanted this, but as a supporting example of where this could be used, see the file trees for project layouts in uv (rendered here — preferring the unrendered version as this could go out of date).

The example above sure does look prettier. It sounds like more work for me to maintain than running tree, but maybe that's worth it.

@CLOVIS-AI
Copy link

This would be great! So far, I have used code blocks to display folder structures (e.g. here), having nice icons would make this even better!

@squidfunk
Copy link
Owner

We're planning to introduce a component-centric approach, very likely next year. The "when" depends on how fast we're with our foundational work, but we definitely want to make componentization easier, which would allow to implement a component like this and use it in different themes – not only in Material for MkDocs.

@pawamoy
Copy link
Contributor

pawamoy commented Dec 20, 2024

Just found this issue. Have a look at https://pawamoy.github.io/markdown-exec/usage/tree/. It doesn't allow collapsing/expanding folders, but this could be achieved with a bit of Javascript, probably. You can already push it quite far, see https://pawamoy.github.io/markdown-exec/gallery/#file-trees and https://mkdocstrings.github.io/griffe/guide/contributors/architecture/#project-architecture (source).

@kowyo
Copy link

kowyo commented Dec 24, 2024

In a Hugo document theme named Hextra, I have seen good implementation: https://imfing.github.io/hextra/docs/guide/shortcodes/filetree, would like to see if MkDocs also has one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change request Issue requests a new feature or improvement
Projects
None yet
Development

No branches or pull requests

6 participants