plantuml / plantuml

Generate diagrams from textual description
https://plantuml.com
Other
9.73k stars 881 forks source link

Directory tree listing #1448

Open vanillajonathan opened 11 months ago

vanillajonathan commented 11 months ago

Is your feature request related to a problem? Please describe. I want a directory listing.

Describe the solution you'd like

@startfiles
/.github
/src/example.py
/tests/example_test.py
/README.md
/LICENSE
@endfiles

PlantUML should render this prettily!

📁 .github
📂 src/
   📄 example.py
📂 tests/
   📄 example_test.py
📄 README.md
📄 LICENSE

or:

├── .github
├── src
│   ├── example.py
├── tests
│   ├── example_test.py
├── README.md
└── LICENSE
arnaudroques commented 11 months ago

Sounds like an interesting suggestion... and it should be easy to implement. We like your first rendering with emoticons.

Before starting, few questions:

@startfiles
/.github
/src/example1.py
/tests/example_test.py
/src/example2.py
/README.md
/LICENSE
strange_file.txt
@endfiles
vanillajonathan commented 11 months ago

It probably should not sort the file names, I think it should use the same order as they are written, then it is up to the users to write them in his desired order if he want them sorted or not. On the other hand, maybe the implementation would be easier if it were sorted, then that would be fine too.

I don't know how files or directories that does not start with a slash should be rendered, but I think all files in the same directory should be rendered together in the same directory since directory names must be unique.

@startfiles
/src/example1.py
/tests/example_test.py
/src/example2.py
@endfiles

Would be rendered as:

📂 src/
   📄 example1.py
   📄 example2.py
📂 tests/
   📄 example_test.py
arnaudroques commented 11 months ago

Ok, thanks.

Another simple question: In your first example:

@startfiles
/.github
/src/example.py
/tests/example_test.py
/README.md
/LICENSE
@endfiles

.github is displayed as a folder. But how do we know that it is a folder and not a simple file?

Maybe we should have:

@startfiles
/.github/
/src/example.py
/tests/example_test.py
/README.md
/LICENSE
@endfiles

Any though?

vanillajonathan commented 11 months ago

Good point! Yes, I agree it should end with a slash in order to be rendered as a folder.

There could also be different file icons rendered depending on the file extension.

arnaudroques commented 11 months ago

It's really a pre-alpha version that does not work as specified yet.

But I wanted to let you know that some work have been started.

Thanks for suggestion and stay tuned :-)

arnaudroques commented 11 months ago

We've made some progress :-)

Any though?

Icons are not perfect (especially the colors). Do you know any free svg files we could use for files and folder icons?

The-Lum commented 11 months ago

Here is a possible example:

vanillajonathan commented 11 months ago

There needs to be some space between the icon and the file name.

Bootstrap icons are available under the MIT License. https://icons.getbootstrap.com/?q=file- https://icons.getbootstrap.com/?q=folder-

jimmyoc001 commented 10 months ago

Really love this as I need something like this for my documentation. do you think it's possible to add notes at some point? Would be really useful.

arnaudroques commented 10 months ago

So with last snapshot, you can have this:

@startfiles
/.github/
/src/example.py
/src/iiimple1.py
/tests/example_test.py
/src/wwwmple2.py
/tests/v1/example_test.py
/README.md
/doc/foo/dummy.doc
<note>
this is a note
on two lines
</note>
/LICENSE
@endfiles

This is still an early version, we are not satisfied with the syntax. Any idea is welcome!

The-Lum commented 10 months ago

Hi,

A mean question will be:

Regards

vanillajonathan commented 10 months ago

Maybe each file could have a separate comment to the right of the file name. Example:

@startfiles
/.github  # Contains GitHub-specific files such as CI
/src/example.py
/tests/example_test.py
/README.md  # This is Markdown format
/LICENSE  # Contains the license
@endfiles
sahyung commented 9 months ago

is it possible to have multi color folders? example for this code, the folder foo and v1 has color yellow, and the rest still use blue.

vanillajonathan commented 9 months ago

Files and folders starting with a dot, example .github (hidden) could be dimmed.

The-Lum commented 9 months ago

@sahyung:

is it possible to have multi color folders? example for this code, the folder foo and v1 has color yellow, and the rest still use blue.

Good request...

For a new enhancement... (and group of all new wanted features).

Regards, Th.

The-Lum commented 9 months ago

@vanillajonathan:

Files and folders starting with a dot, example .github (hidden) could be dimmed.

For a new enhancement... (and group of all new wanted features).

Regards, Th.

swmatisa commented 5 months ago

Any news? It would also be nice to be able to style for example

davide1995 commented 5 months ago

Looks like if I write following: /tests/__init__.py It doesn't render correctly

Screenshot 2023-11-21 at 11 50 43
The-Lum commented 5 months ago

Hi @davide1995, and all,

It is due to the Creole management, see this funny example:

@startfiles
/tests/__init_file__.py
/tests/~__init_file__.py

/**creole_test**/~~wave~~
/**creole_test**/**bold**
/**creole_test**/""monospaced""
/**creole_test**/--stricken-out--
/**creole_test**/__underlined__
/**creole_test**/~__not underlined__
/**creole_test**/~~wave-underlined~~
/**creole_test**///not italics :)//

/**creole_html_test**/<b>bold
/**creole_html_test**/<i>italics
/**creole_html_test**/<font:monospaced>monospaced
/**creole_html_test**/<s>stroked
/**creole_html_test**/<u>underlined
/**creole_html_test**/<w>waved
/**creole_html_test**/<s:green>stroked
/**creole_html_test**/<u:red>underlined
/**creole_html_test**/<w:#0000FF>waved
/**creole_html_test**/<color:blue>Blue
/**creole_html_test**/<back:orange>Orange background
/**creole_html_test**/<size:20>big
@endfiles

Enjoy... :-) Regards.

swmatisa commented 5 months ago

Hello, I also try to put Archimate sprite and it is not working

arnaudroques commented 5 months ago

Funny indeed :-) However, we have disabled creole in last snapshot for filenames (tell us if you would like to have creole except for underline) Hope this help!

The-Lum commented 5 months ago

Hi,

Ok: to disable all Creole temporary.

But perhaps it will be interesting to have commands to highlight some folder or file, why not with the HTML creole form (where you are sure that those folder or filename don't include this HTML form inside there names... ).

Regards, Th.

vanillajonathan commented 5 months ago

It could even use different icons for different file extensions.

swmatisa commented 5 months ago

Hi, If I cannot use Creole, HTML creole will be good. Style and icon use will be alternatives

swmatisa commented 4 months ago

Hi, Could you please add "common commands" like title, legend, caption, etc. ?

MySpamKit commented 4 months ago

Hi, Is there a way to include remarks or notes about a particular file or directory in its vicinity?

The-Lum commented 4 months ago

Hi @MySpamKit

Is there a way to include remarks or notes about a particular file or directory in its vicinity?

Yes, currently only below a file (not for directory) you can see this:

Regards, Th.

MySpamKit commented 4 months ago

Thank you :-)

dgrigonis commented 3 months ago

To me what would be useful is to be able to connect individual tree entries to other graphs. Specifically, adding this dimension to component diagrams to see how application fits into filesystem is what I am trying to do now.

map {} seems to fit ok for this purpose, except can't find how to align key text.

AlexCzar commented 2 months ago

Are themes not supported? I'm using plantuml-asl-1.2024.3 and

!theme crt-amber from https://raw.githubusercontent.com/plantuml/plantuml/master/themes

other diagrams are rendered in the specified theme, but if I try to do the same with directory listing, it's white background, blue folders, gray files.

The-Lum commented 2 months ago

Hello @AlexCzar,

[Just for traceability] You are right, that is not yet implemented, as for regex:

Awaiting style improvement, Regards, Th.

mredenti commented 4 days ago

Is it possible to render them with Pandoc when embedding the code in markdown?

For examples I would like something like the following in a .md file

@startfiles
/.github
/src/example.py
/src/example1.py
/tests/example_test.py
/src/example2.py
/tests/v1/example_test.py
/README.md
/doc/foo/dummy.doc
/LICENSE
@endfiles

and call pandoc to render it

The-Lum commented 4 days ago

Hello @mredenti,

Is it possible to render them with Pandoc when embedding the code in markdown?

Yes you can, but that is not directly relevant of plantuml itself (and not a question here on plantuml/plantuml repo.)!

For this reason:

Here are some first results, to test and analyse....:

Go to test and Enjoy, Regards, Th.

Mairu commented 2 days ago

Hi,

the notes are currently not indented for nested empty directories, is this intended?

@startfiles
/.github/
<note>
this note should be for .github
</note>
/.github/template/
<note>
this note should be for the template folder and indented
</note>
/doc/
<note>
this is a note for /doc
</note>
/doc/foo/dummy.doc
<note>
this is a note
on two lines
</note>
/LICENSE
@endfiles
The-Lum commented 2 days ago

Hello @Mairu,

Currently only notes for file, not for folder, are available.

See the above remark:

Then for folder that will be now a wanted feature...

And on the same topic, see also an old issue on notes here:

Regards, Th.