Convert your favorite Medium articles into markdown files using Medium2md
, a powerful and user-friendly command-line tool. Designed in Python, it extends beyond simple conversion to download all images within the article, saving them locally and integrating them into your markdown file seamlessly.
- Efficient Conversion: Download Medium articles as HTML and convert them into clean, readable Markdown files.
- Image Handling: Download images from the article, save them locally, and update image URLs in the markdown files to point to local paths.
- Post-Processing: Automatically clean up unnecessary data after conversion.
- User-Friendly: Interactive CLI interface with progress bars and prompts for an enhanced user experience.
- Python 3.8 or later
- Conda
-
Clone the repository:
git clone https://github.com/siddharthksah/medium2md.git
-
Navigate into the project directory:
cd medium2md
-
Create a new conda environment and activate it:
conda create --name medium2md python=3.8 -y conda activate medium2md
-
Install the package and its dependencies using
setup.py
:python3 setup.py install playwright install
This will automatically install all required packages listed in
setup.py
'sinstall_requires
section.
Run medium2md
with:
python3 src/main.py -u <URL>
Replace with the URL of the Medium article you wish to download. If no URL is provided, the script will prompt you to input one.
When the process is complete, the script will ask if you wish to open the downloaded markdown file in your default editor.
The converted articles are stored in the output directory, which is created in the project's root directory.
To run the unittests for the Medium2md
project, navigate to the root directory of the project and use the following command:
python -m unittest discover unittests
This will automatically discover and run all the unittests in the unittests directory.
Please ensure that you have installed the required packages for the project by following the installation instructions in the Getting Started
section.
.
├── LICENSE.txt
├── README.md
├── docs
├── output
├── requirements.txt
└── src
├── __init__.py
├── clean_md.py
├── clean_unnecessary_data.py
├── download_with_media.py
├── html_to_md.py
├── main.py
└── url_to_local.py
We welcome contributions! If you would like to make changes, please submit a pull request. For substantial updates, we request that you open an issue first to discuss the proposed changes.
Medium2md
is licensed under the terms of the MIT License. For the full text, see the LICENSE file.