Skip to content

Automatically generate table of contents for a file tree containing markdown files

Notifications You must be signed in to change notification settings

technogleb/auto_summary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Automatically generate for a file tree containing markdown files

Auto Summary allows to generate SUMMARY files for directory (and its subdirectories) containing Markdown files. This can be useful for maintaining personal knowledge database or team wiki. Auto summary can also watch your filetree and update all links on any file change, such as renaming, moving file around, deleting etc...

Auto Summary is availiable as a standalone python script and as vim plugin.

Auto Summary creates <DIRNAME>.md files for every directory and its subdirectories, where it finds markdown files, where DIRNAME is current directory name. See example below.

demo

Contents

Python CLI utility

Install

  1. Clone the repo

git clone https://github.com/technogleb/auto_summary.git ~/

  1. If you want to automatically watch for changes, you need to install watchdog
pip3 install -r ~/auto_summary/requirements.txt

Use

  1. Generate SUMMARY
python3 ~/auto_summary/cli.py -r path/to/your/markdown/root

If you want to have wikilinks instead of classic markdown links, pass --wikilinks option

python3 ~/auto_summary/cli.py -r path/to/your/markdown/root --wikilinks
  1. Automatically watch for changes

To automatically watch changes and update links, run cli with --watch_changes option. Note that it requires watchdog to be installed.

python3 ~/auto_summary/cli.py -r path/to/your/markdown/root --watch_changes

VIM plugin

Auto Summary can also be used as a Vim(NeoVim) plugin.

Install plugin

  1. Via your favorite plugin manager (here I use Vundle for example)

Add this to your .vimrc file (or to ~/.config/nvim/init.vim if you use NeoVim)

Plugin technogleb/auto_summary

Don't forget to source your .vimrc later and run :PluginInstall

  1. Manually
mkdir -p ~/.vim/my_package/my_package/start
git clone https://github.com/technogleb/auto_summary.git ~/.vim/my_package/my_package/start

Install watchdog

In order to use automatic mode, you need to install watchdog. Installation differs for Vim and NeoVim.

  1. Vim

NOTE: Auto Summary only supports python3.

NOTE: Vim can only use the python it was compiled with, so you have to install watchdog in its' site-packages dir.

NOTE: watchdog may conflict with other plugins, using watchdog, such as YouCompleteMe

  1. Find python, your vim was compiled with by vim --version

  2. Install watchdog

/path/to/vim-compiled/python -m pip install -r ~/.vim/bundle/auto_summary/requirements.txt
  1. NeoVim

Use you default system python3, or install it into virtual environment

pip3 install -r ~/.vim/bundle/auto_summary/requirements.txt

Use Plugin

  1. Generate SUMMARY

:Summarize - generates SUMMARY, starting from your session root - i.e. where you started your current vim session

:Summarize <path/to/root> - generates SUMMARY, starting from path specified

  1. Automatically watch for changes

In order to automatically watch for changes, set let g:watch_markdown_changes=1

About

Automatically generate table of contents for a file tree containing markdown files

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published