mplib

Crates.iomplib
lib.rsmplib
version0.1.1
created_at2025-12-05 03:15:46.897822+00
updated_at2025-12-19 21:28:33.539967+00
descriptionmplib: Micropub Publisher Library | Publish text-only blog posts to Micropub endpoints.
homepagehttps://github.com/mjdescy/mp
repositoryhttps://github.com/mjdescy/mp
max_upload_size
id1967623
size55,595
Michael Descy (mjdescy)

documentation

README

mplib: Micropub Publisher Library

A Rust library for publishing text-only blog posts to any Micropub-compatible blogging service.

Overview

mplib can be integrated into your own applications to add Micropub publishing capabilities of text-only content.

Features

  • ✅ Publish posts and drafts to Micropub endpoints
  • ✅ Handle Micropub service authentication with API tokens
  • ✅ Async/await support with Tokio
  • ✅ Built with Rust for performance and reliability

Compatible Microblogging Services

mplib is known to work with the microblogging services listed below.

Service Name API URL
Micro.blog https://micro.blog/micropub

Installation

Add mplib to your Cargo.toml:

[dependencies]
mplib = { version = "0.1.0" }  # Use appropriate version
tokio = { version = "1.0", features = ["full"] }

Usage

use mplib::{MicropubService, Post, PostStatus, publish_post};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create a Post
    let post = Post::from_body_and_title(
        "This is the post body".to_string(),
        "Post title".to_string(),
        PostStatus::Published  // change to PostStatus::Draft to create a draft
    )
    
    // Create a MicropubService configuration
    let service = MicropubService::new(
        "https://micro.blog/micropub".to_string(),
        "your-auth-token".to_string()
    );

    // Publish the Post on the MicropubService
    match publish_post(post, service).await {
        Ok(result) => {
            println!("{}", result.as_string());
        }
        Err(e) => {
            eprintln!("Error publishing post");
            eprintln!("{}", e);
            std::process::exit(1);
        }
    }
}

Requirements

  • Rust 1.70+
  • A Micropub-compatible blogging service

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Author

Michael Descy mike@mjdescy.me

Support

If you encounter any issues or have questions, please file an issue on the GitHub repository.

Commit count: 0

cargo fmt