Skip to content

Generate and render a tree dynamically #44

Answered by pawamoy
NikosAlexandris asked this question in Q&A
Discussion options

You must be logged in to vote

I've written a small function that prints the content of a directory. Of course it can be further customised to match the expected tree code-block structure.

So, does it work 🙂?

Instead of using print(f"```\n{tree}\n```") I think you can simply print the tree without fences, and add result="tree" to your code block options.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by pawamoy
Comment options

You must be logged in to vote
1 reply
@pawamoy
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants