documenter.py
is a Python script that automatically generates an HTML-based documentation of your project’s file structure and contents. It walks through a specified project directory, lists all subdirectories and files, and includes the code or text from each file in an easy-to-navigate HTML page.
Notable features include:
- Copy Button next to each file for quick copy-pasting of individual file contents.
- Copy ALL Text button to copy every file’s content into your clipboard at once.
- Optional Sensitive Information Masking (removes
$host
,$user
,$pass
,$db
,$charset
lines). - Ignore Mechanism to skip certain directories/files (like
.git
,.DS_Store
, etc.). - No External Dependencies beyond Python’s standard library.
- Clone the repository (or download the script directly):
git clone https://github.com/josephbartlett/code-documenter.git
- Navigate into the directory:
cd code-documenter
- Ensure you have Python 3.x installed.
- No additional dependencies are required.
Run the script with Python, specifying the target directory you want documented:
python documenter.py /path/to/project
-
directory
(required)
Path to the project directory you want to document. -
-o
,--output
(optional)
Name of the output HTML file.
Default:<directoryname>_Documentation.html
. -
-r
,--remove_sensitive
(optional)
Remove sensitive information (lines containing$host
,$user
,$pass
,$db
,$charset
). -
-i
,--ignore_list
(optional)
Provide a list of substrings or filenames to ignore.
Example:-i node_modules venv test.log
-
--include_all
(optional)
Override all ignores and include every file/folder in the documentation.
# Generate documentation for the "my_project" folder
python documenter.py my_project
# Generate documentation and output to custom filename
python documenter.py my_project -o docs.html
# Generate documentation, remove sensitive info, and ignore "node_modules"
python documenter.py my_project -r -i node_modules
# Ignore nothing (include all files)
python documenter.py my_project --include_all
When complete, you’ll have an HTML file containing:
- A clickable list of your project’s folders and files.
- File content in
<pre>
blocks for each file, with “Copy” buttons. - A “Copy ALL Text” button that copies content from all files.
This project is licensed under the MIT License.
Joseph Bartlett
Email: [email protected]
GitHub: github.com/josephbartlett
Feel free to reach out or open an issue if you have any questions or suggestions.