A web service that renders Mastodon threads in various formats, allowing for easy embedding and conversion of Mastodon conversations.
- Render Mastodon threads with embedded toots
- Convert Mastodon threads to Markdown
- Support for media attachments and alt texts
- Automatic thread reconstruction, including finding the root toot and all replies
- Rust (latest stable version recommended)
- Cargo
- Node.js and npm (for building frontend assets)
Clone the repository and build the project:
git clone https://github.com/yourusername/masto-thread-renderer.git
cd masto-thread-renderer
cargo build --releaseThe build process will automatically handle npm dependencies through the npm_rs crate.
cargo runBy default, the server will run on http://localhost:8000.
RUST_LOG: Sets the log level (e.g.,info,debug,trace)
GET /healthz
Returns OK if the service is running properly.
GET /
Renders the main index page with a form to enter a Mastodon toot URL.
GET /thread?url={mastodon_toot_url}
Renders a full thread with embedded toots, starting from the provided URL.
GET /markdown?url={mastodon_toot_url}
Converts a Mastodon thread to Markdown format, including media attachments.
- When provided with a Mastodon toot URL, the service finds the original toot.
- It then traverses both ancestors and descendants to reconstruct the full thread.
- For embedding, it generates the necessary iframe code to display each toot.
- For Markdown, it extracts the content and media attachments and converts them to Markdown format.
cargo testThe application uses Askama templates located in the public/html directory:
index.html- The main index pagethread.html- Template for rendering embedded threadsmarkdown.html- Template for Markdown conversionerror.html- Error page templatecomponents/- Reusable template components