/fstree2md

File System Tree to Markdown

Primary LanguageScalaMIT LicenseMIT

fstree2md

File System Tree to Markdown

Build Status codecov.io License: MIT

Overview

Generate a Markdown file recursively listing the contents of a directory. It groups all files with the same name and generate semantic links according to the file extensions.

Supported file extensions

Each file is categorized according to its extension. Supported file extensions are:

  • md => Markdown
  • pdf => Slides
  • mp4 => Video
  • srt => Subtitles
  • html => Html
  • txt => Text
  • zip => Zip

Usage

sbt "run {rootDirectory} {targetMdFileRelativeToRootDir} {pathsToIgnore}"

Example

From this directory structure:

├── fstree/
│   ├── file0.mp4
│   ├── file0.pdf
│   ├── file0.srt
│   ├── dir1/
│   │   ├── file1-1.mp4
│   │   ├── file1-1.pdf
│   │   ├── file1-1.srt
│   │   ├── dir1-1/
│   │   │   ├── ...
│   ├── dir2/
│   │   ├── file2-1.mp4
│   │   ├── file2-1.pdf
│   │   ├── file2-1.srt
│   │   ├── file2-2.mp4
│   │   ├── file2-2.pdf
│   │   ├── file2-2.srt
│   │   ├── dir2-1/
│   │   │   ├── ...
│   ├── dir3/
│   │   ├── file3-1.mp4
│   │   ├── file3-1.pdf
│   │   ├── file3-1.srt
│   │   ├── dir3-1/
│   │   │   ├── file3-1-1.mp4
│   │   │   ├── file3-1-1.pdf
│   │   │   ├── file3-1-1.srt

executing

sbt "run fstree README.md dir1-1,dir2-1"

the generated markdown file would look like:

# fstree
---
* file0 ([Slides](file0.pdf), [Video](file0.mp4), [Subtitles](file0.srt))
* dir1
	* file1-1 ([Slides](dir1/file1-1.pdf), [Video](dir1/file1-1.mp4), [Subtitles](dir1/file1-1.srt))
* dir2
	* file2-1 ([Slides](dir2/file2-1.pdf), [Video](dir2/file2-1.mp4), [Subtitles](dir2/file2-1.srt))
	* file2-2 ([Slides](dir2/file2-2.pdf), [Video](dir2/file2-2.mp4), [Subtitles](dir2/file2-2.srt))
* dir3
	* file3-1 ([Slides](dir3/file3-1.pdf), [Video](dir3/file3-1.mp4), [Subtitles](dir3/file3-1.srt))
	* dir3-1
		* file3-1-1 ([Slides](dir3/dir3-1/file3-1-1.pdf), [Video](dir3/dir3-1/file3-1-1.mp4), [Subtitles](dir3/dir3-1/file3-1-1.srt))

Real examples

The following repositories have an autogenerated README file:

References

License

MIT License