| Crates.io | mplib |
| lib.rs | mplib |
| version | 0.1.1 |
| created_at | 2025-12-05 03:15:46.897822+00 |
| updated_at | 2025-12-19 21:28:33.539967+00 |
| description | mplib: Micropub Publisher Library | Publish text-only blog posts to Micropub endpoints. |
| homepage | https://github.com/mjdescy/mp |
| repository | https://github.com/mjdescy/mp |
| max_upload_size | |
| id | 1967623 |
| size | 55,595 |
A Rust library for publishing text-only blog posts to any Micropub-compatible blogging service.
mplib can be integrated into your own applications to add Micropub publishing capabilities of text-only content.
mplib is known to work with the microblogging services listed below.
| Service Name | API URL |
|---|---|
| Micro.blog | https://micro.blog/micropub |
Add mplib to your Cargo.toml:
[dependencies]
mplib = { version = "0.1.0" } # Use appropriate version
tokio = { version = "1.0", features = ["full"] }
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);
}
}
}
This project is licensed under the MIT License - see the LICENSE.md file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
Michael Descy mike@mjdescy.me
If you encounter any issues or have questions, please file an issue on the GitHub repository.