tree to markdown command
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "tree"
|
||||
tags: [ "basics" ]
|
||||
tags: [ "basics", "tree", "markdown" ]
|
||||
---
|
||||
|
||||
The `tree` utility outputs a full listing of everything in your current directory, and those below.
|
||||
@@ -23,3 +23,14 @@ README.md
|
||||
```
|
||||
|
||||
Each description-line starts with a tab.
|
||||
|
||||
## Markdown Conversion
|
||||
|
||||
To represent a file structure as a nested series of markdown lists, you can try this horrifying `sed` one-liner:
|
||||
|
||||
```bash
|
||||
tree -tf --dirsfirst --gitignore --noreport --charset ascii | \
|
||||
sed -e 's/| \+/ /g' \
|
||||
-e 's/[|`]-\+/ */g' \
|
||||
-e 's:\(* \)\(\(.*/\)\([^/]\+\)\):\1[\4](\2):g'
|
||||
```
|
||||
|
Reference in New Issue
Block a user