3 releases

0.1.2 May 30, 2024
0.1.1 Apr 15, 2024
0.1.0 Apr 15, 2024

#454 in Command line utilities

Download history 13/week @ 2024-07-29 24/week @ 2024-09-23

177 downloads per month

GPL-2.0-or-later WITH Bison-exception-2…

26KB
222 lines

Medium to Markdown Parser and CLI Tool

This Rust utility converts Medium blog posts into Markdown format, enabling users to preserve their content independently of centralized platforms. With this tool, you can safeguard your blog posts against potential risks associated with platform changes or shutdowns.

Medium provides a convenient platform for hosting blogs and reaching a wide audience. However, relying solely on Medium for content hosting carries risks. If Medium were to go down or change its policies, the hard work of blog writers would be at risk. To mitigate this risk, this project aims to provide a simple yet effective tool for converting Medium blog posts into Markdown format.

Features

  • Headings (H1)
  • SubHeadings (H2)
  • Paragraphs (p)
  • Inline Tags this (code)
  • Code Blocks : Ctrl + Alt+6 The ones where you read code (pre)
  • Images (source)
  • Line Breaks (br)
  • Bold (b,strong), Italics (i)
  • Lists (li)

Installation

Install directly from cargo.

cargo install medium-to-markdown

Usage

The command-line interface (CLI) accepts a Medium blog post URL and a filename as input and generates the Markdown content.

medium-to-markdown <URL> <file_name>

Replace with the URL of the Medium blog post you want to convert, and <file_name> with the desired filename for the Markdown output.

Example

medium-to-markdown https://medium.com/@harshiljani2002/building-stock-market-engine-from-scratch-in-rust-i-9be7c110e137 blog_post.md

Developer Setup

To set up the project, follow these steps:

  1. Clone the repository:
git clone https://github.com/Harshil-Jani/medium-to-markdown.git
  1. Install Rust and Cargo if you haven't already.

  2. Navigate to the project directory:

cd medium-to-markdown
  1. Build the project:
cargo build --release

Testing

The project includes unit tests to ensure the correctness of the parser. To run the tests, use the following command:

cargo test

Contributions

Contributions to this project are welcome. If you encounter any issues or have suggestions for improvements, feel free to open an issue or submit a pull request on GitHub.

Dependencies

~8–19MB
~262K SLoC