Skip to content

Instantly share code, notes, and snippets.

@vanvanni
Created August 23, 2023 11:45
Show Gist options
  • Save vanvanni/5a3e0aa44145830aaf79972f37567ee6 to your computer and use it in GitHub Desktop.
Save vanvanni/5a3e0aa44145830aaf79972f37567ee6 to your computer and use it in GitHub Desktop.
Simple but not perfect function to export your tree to a markdown code block
function mdtree () {
echo '```' > $1
tree -I 'node_modules|dist|build|.git|$1' --dirsfirst --prune >> $1
echo '```' >> $1
}
@vanvanni
Copy link
Author

Usage
mdtree export-file.md

Flaw
It wil also include the export-file.md within the tree, because it is created before tree reading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment