From 9c4a54219338bfffca18ca21910da542a84d5435 Mon Sep 17 00:00:00 2001 From: lumin Date: Fri, 20 Dec 2024 23:58:14 +0900 Subject: [PATCH] docs: update README with Docker instructions and details Enhance the README by adding detailed Docker usage instructions, including build, version check, and conversion commands for both Windows and Linux. This improves accessibility for users who prefer using Docker for the project. --- README.md | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6b51415..564c89e 100644 --- a/README.md +++ b/README.md @@ -66,14 +66,41 @@ result = md.convert("example.jpg") print(result.text_content) ``` -### Docker +
+Docker + +#### Build ```sh docker build -t markitdown:latest . -docker run --rm -i markitdown:latest < ~/your-file.pdf > output.md ``` + +#### Check version + +```sh +docker run --rm markitdown:latest --version +``` + +#### Convert + +- On Windows (PowerShell): + +```sh +docker run --rm --volume ${pwd}:/src --workdir /src markitdown:latest ./path-to-your-file.pdf +``` + +- On Linux: + +```sh +docker run --rm --volume $(pwd):/src --workdir /src markitdown:latest ./path-to-your-file.pdf +``` + +Note: When specifying the file path, always use `/` as the separator, even on Windows (e.g., ./my-folder/my-file.pdf). + +
+
- + Batch Processing Multiple Files This example shows how to convert multiple files to markdown format in a single run. The script processes all supported files in a directory and creates corresponding markdown files. @@ -94,7 +121,7 @@ for file in files_to_convert: result = md.convert(file) with open(md_file, 'w') as f: f.write(result.text_content) - + print(f"Successfully converted {file} to {md_file}") except Exception as e: print(f"Error converting {file}: {str(e)}") @@ -108,7 +135,7 @@ print("\nAll conversions completed!") Note that original files will remain unchanged and new markdown files are created with the same base name.
- + ## Contributing This project welcomes contributions and suggestions. Most contributions require you to agree to a