Generate GitHub-style directory for local Markdown files

This is an
example of a python script that generates a GitHub-style directory for a local Markdown file : For
example, if you have a Markdown file and want to generate a directory.
1. Copy the file to a directory first (note that the directory must have write permission. If the program reports an error indicating that there is no write permission, copy the file to a directory with write permission. Generally, the folder on the desktop There is write permission in it) and name the file README.md:

2. Next, copy the python script to the directory (you can also create a new python script to directly copy and paste the source code, and name the python script TOC .py):

3. Then, hold down the shift key in the directory and then right-click the mouse to open the command line (powershell window):

4. Then enter in the powershell window python TOC.py README.mdand press Enter: the

window shows "file has been generated" Successfully, check the directory and you will find the new file generated:

this file generates a GitHub-style directory Markdown file:

source code: https://github.com/liuhao326/pythontools/blob/master/TOC.py

Guess you like

Origin www.cnblogs.com/Higurashi-kagome/p/12724993.html