MrRaindrop / tree-cli

🌴List contents of directories in tree-like format.
MIT License
253 stars 24 forks source link

feature_request(option): Markdown output #21

Open Kristinita opened 4 years ago

Kristinita commented 4 years ago

1. Summary

It would be nice, if would be possible print output to Markdown format.

2. Example data

Simple tree structure:

KiraTreeCLI/
├── KiraDirectory/
│   └── KiraSecondFile.txt
└── KiraFirstFile.txt

3. Expected result

# KiraTreeCLI

1. KiraFirstFile.txt

## KiraDirectory

1. KiraSecondFile.txt

4. Argumentation

I want to publish my big list of books, so that it can be conveniently referenced. For example, that would be possible show my Astronomy books to other users, I could share link https://kristinita.netlify.app/Special/Полная-библиография#Астрономия; Physics books — https://kristinita.netlify.app/Special/Полная-библиография#Физика and so on.

Yes, I know regular expressions. But currently, I have tree → Markdown conversion difficulties, because I can’t do, that files would be higher than directories in output (KiraFirstFile.txt than KiraDirectory/).

5. Examples of expected behavior

5.1. Markdown format

It would be very nice, if tree-node-cli can print output in Markdown format directly. For example, if I will run command:

tree --markdown

I will get the expected result from section «Expected result»:

# KiraTreeCLI

1. KiraFirstFile.txt

## KiraDirectory

1. KiraSecondFile.txt

5.2. dirs-end

If you are for any reason will not do conversion to Markdown, it would be nice to have at least --dirs-end option. Files in this case will always be located above the directories.

tree --dirs-end
KiraTreeCLI/
├── KiraFirstFile.txt
└── KiraDirectory/
    └── KiraSecondFile.txt

6. Not helped

I couldn’t find in Internet third-party tools for conversion filesystem tree structure to Markdown format.

7. Do not offer

I don’t need to convert filesystem tree structure to Markdown list; please, do not offer it. I need, that directories and subdirectories would be converted to Markdown headers; please, read section «Argumentation».

Thanks.

MrRaindrop commented 4 years ago

Hi,

I don't think this tool should do work other than tree command processing, including converting the generated data into a certain form.

The tree-cli generated data already contains the information to generate the format you need. In theory, you can use this information to make a separate tool for conversion.

But I am sorry that I have no plans or energy to make a separate tool to do this level of conversion.

I can keep this issue open to see if anyone else in the community can help implement this feature.