medium-publish
Overview
Medium Publish is a Python package designed to streamline the process of converting Markdown files into HTML, while also enabling the embedding of images and publishing code snippets as Gists on GitHub. This tool is particularly useful for writers and developers who want to share their content on Medium with rich formatting and embedded resources.
Features
- Markdown Processing: Convert Markdown files to HTML with support for code blocks and lists.
- Image Handling: Automatically embed images from URLs or local paths into the generated HTML.
- Gist Publishing: Publish code snippets as Gists on GitHub and replace them in the HTML with links.
- Clipboard Support: Copy the final HTML output directly to your clipboard for easy sharing.
Table of Contents
Installation
To install Medium Publish, you need to have Python 3.12 or higher. You can install the package using Poetry:
poetry install
Usage
To use Medium Publish, run the command line interface (CLI) tool with the required parameters:
medium-publish <file_path> [--output <output_path>] [--embed-images]
Parameters
file_path: The path to the Markdown file you want to process.--output: (Optional) Specify an output file path for the modified HTML.--embed-images: (Optional) Use this flag to embed images in the output HTML.
Example
medium-publish my_article.md --output my_article.html --embed-images
This command will process my_article.md, embed any images found, and save the output as my_article.html.
File Structure
The project is organized as follows:
medium_publish/
├── __init__.py # Package initialization
├── image_processor.py # Image downloading and embedding logic
├── process_file.py # Markdown processing functions
├── copy_to_clipboard.py # Functionality to copy HTML to clipboard
├── main.py # Main entry point for CLI tool
└── .gitignore # Git ignore file
pyproject.toml # Project metadata and dependencies
README.md # Project documentation
Configuration
Before running Medium Publish, ensure you have set your GitHub token in your environment variables:
export GITHUB_TOKEN="your_github_token"
This token is required for publishing Gists.
Contributing
Contributions are welcome! If you have suggestions or improvements, please fork the repository and submit a pull request.
- Fork it (https://github.com/yourusername/medium-publish/fork)
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for medium-publish 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| medium_publish-0.2.0.tar.gz | 10.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| medium_publish-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.1 kB
Release files / medium_publish-0.2.0.tar.gz
| Download URL | medium_publish-0.2.0.tar.gz |
|---|---|
| Size | 10.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d957a10c22660d369990be2cc379289a2800e30268c6af3fb526afe5cc873407
|
|
BLAKE2b-256 checksum How to use checksums |
e3b27eab3fca07344fcf8697afb3230c21ba545cd1d72f69fb0a21d5ddc94c6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.7 Darwin/24.2.0
|
Release files / medium_publish-0.2.0-py3-none-any.whl
| Download URL | medium_publish-0.2.0-py3-none-any.whl |
|---|---|
| Size | 12.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
823f27f191f425b1a958bdad0d1734c3638c35767e0d93890973fc4b6968691a
|
|
BLAKE2b-256 checksum How to use checksums |
e5040b8cc7c0684efd026a97f5f6b2f23393ca1df5bf56fe876b8439508bfeee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.7 Darwin/24.2.0
|