Skip to content

Commit 8e5ae9b

Browse files
committed
Update README.md
1 parent 68e26dd commit 8e5ae9b

File tree

1 file changed

+103
-3
lines changed

1 file changed

+103
-3
lines changed

README.md

Lines changed: 103 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,105 @@
1-
# Masto Thread Renderer
1+
# Masto-Thread-Renderer
22

3-
This app will display Mastodon thread (only author toots, no replies) as a web page for reading.
3+
A web service that renders Mastodon threads in various formats, allowing for easy embedding and conversion of Mastodon conversations.
44

5-
It can also fetch toot contents and display it as Markdown, so that it could be converted into a static blog post
5+
## Features
6+
7+
- Render Mastodon threads with embedded toots
8+
- Convert Mastodon threads to Markdown
9+
- Support for media attachments and alt texts
10+
- Automatic thread reconstruction, including finding the root toot and all replies
11+
12+
## Installation
13+
14+
### Prerequisites
15+
16+
- Rust (latest stable version recommended)
17+
- Cargo
18+
- Node.js and npm (for building frontend assets)
19+
20+
### Building
21+
22+
Clone the repository and build the project:
23+
24+
```bash
25+
git clone https://github.com/yourusername/masto-thread-renderer.git
26+
cd masto-thread-renderer
27+
cargo build --release
28+
```
29+
30+
The build process will automatically handle npm dependencies through the `npm_rs` crate.
31+
32+
## Usage
33+
34+
### Running the server
35+
36+
```bash
37+
cargo run
38+
```
39+
40+
By default, the server will run on `http://localhost:8000`.
41+
42+
### Environment Variables
43+
44+
- `RUST_LOG`: Sets the log level (e.g., `info`, `debug`, `trace`)
45+
46+
### Health Check
47+
48+
```
49+
GET /healthz
50+
```
51+
52+
Returns `OK` if the service is running properly.
53+
54+
### Index Page
55+
56+
```
57+
GET /
58+
```
59+
60+
Renders the main index page with a form to enter a Mastodon toot URL.
61+
62+
### Thread Embedding
63+
64+
```
65+
GET /thread?url={mastodon_toot_url}
66+
```
67+
68+
Renders a full thread with embedded toots, starting from the provided URL.
69+
70+
### Markdown Conversion
71+
72+
```
73+
GET /markdown?url={mastodon_toot_url}
74+
```
75+
76+
Converts a Mastodon thread to Markdown format, including media attachments.
77+
78+
## How It Works
79+
80+
1. When provided with a Mastodon toot URL, the service finds the original toot.
81+
2. It then traverses both ancestors and descendants to reconstruct the full thread.
82+
3. For embedding, it generates the necessary iframe code to display each toot.
83+
4. For Markdown, it extracts the content and media attachments and converts them to Markdown format.
84+
85+
## Development
86+
87+
### Running Tests
88+
89+
```bash
90+
cargo test
91+
```
92+
93+
### Template System
94+
95+
The application uses Askama templates located in the `public/html` directory:
96+
97+
- `index.html` - The main index page
98+
- `thread.html` - Template for rendering embedded threads
99+
- `markdown.html` - Template for Markdown conversion
100+
- `error.html` - Error page template
101+
- `components/` - Reusable template components
102+
103+
## License
104+
105+
[Apache-2.0 License](LICENSE)

0 commit comments

Comments
 (0)