src2txt
is a command-line tool designed to convert various types of documents and web pages into plain text. It supports processing local files (including PDFs and HTML files) and web URLs. The tool provides options for recursive directory processing, inclusion of hidden files, and can respect .gitignore
rules.
- Convert files and URLs to text.
- Support for multiple file types including text, HTML, and PDF.
- Recursive processing of directories.
- Options to include hidden files and ignore
.gitignore
rules. - Verbose output and listing files without processing.
The recommended method to install src2txt
is using pipx
, which installs Python applications in isolated environments. To install src2txt
using pipx
, run:
pipx install src2txt
If pipx
is not installed, you can install it via pip:
pip install pipx
pipx ensurepath
To use src2txt
, you can invoke it from the command line with various options. Here’s a basic example:
src2txt src_to_text --sources "path/to/file_or_directory" --recursive
-
--sources
: List of file paths or URLs. -
--raw-html
: Return raw HTML content without cleaning. -
--recursive
: Recursively process files in directories. -
--include-hidden
: Include hidden files in the processing. -
--ignore-gitignore
: Ignore.gitignore
rules and include files normally ignored. -
--verbose
: Print verbose output. -
--file-name
: Print the file name or URL before the content. -
--list
: List files and URLs without processing content.
For more detailed usage and options, refer to the help provided by the tool:
src2txt --help
Contributions to src2txt
are welcome.
This project is licensed under the MIT License - see the LICENSE file for details.