I found it frustrating to keep updating the sidebar or table of content by hand. So I wrote a simple code that prints out a list in the correct format so you won't need to write it by hand:
import os
ignore_list = [".git", ".idea", "create_table_of_content.py"]
spaces = " "
def get_all_files_and_directories(path, depth):
spaces_tmp = spaces*depth
file_list = os.listdir(path)
for f in file_list:
if f in ignore_list:
continue
if os.path.isdir(path+"/"+f):
print(f'{spaces_tmp}- {f}')
get_all_files_and_directories(path+"/"+f, depth+1)
elif f.split(".")[-1] == "md":
print(f'{spaces_tmp}- [{f.split(".")[0]}]({f})')
return
if __name__ == '__main__':
c = os.getcwd()
get_all_files_and_directories(c, 0)
Just run it at the root of the wiki repo.
Sample output:
- The-Code is a directory
- editor-applications is a directory
- [edit_hosts_file](edit_hosts_file.ps1.md)
- [mount_logs_dir](mount_logs_dir.ps1.md)
- [main-editor-app](main-editor-app.ps1.md)
- [setup_tasks](setup_tasks.ps1.md)
- [home](home.md)
- [Logging](Logging.md)
- Execution is a directory
- [User-Data](User-Data.md)
- [General](General.md)
- [File-Structure](File-Structure.md)
- [Running-Manually](Running-Manually.md)
- [About](About.md)
This should make it easier to maintain.
Edit
I found this repo https://github.com/ekalinin/github-markdown-toc with a tool that creates a TOC by titles. Personally I think it is better to create a single page with TOC rather then a multi page wiki.