--- /dev/null
+const std = @import("std");
+
+const md = @import("./markdown_parser.zig");
+
+pub const RssFormatter = struct {
+ buffer: std.ArrayList(u8),
+ alloc: std.mem.Allocator,
+
+ /// Create a new RssFormatter that will use the provided allocator.
+ pub fn init(alloc: std.mem.Allocator) @This() {
+ return .{
+ .buffer = .empty,
+ .alloc = alloc,
+ };
+ }
+
+ pub fn deinit(self: *@This()) void {
+ self.buffer.deinit(self.alloc);
+ }
+
+ /// Format the provided
+ pub fn format(self: *@This(), doc: md.MarkdownDoc) ![] const u8 {
+ try self.buffer.appendSlice(
+ self.alloc,
+ \\<item>
+ \\<pubDate>
+ );
+
+ try self.buffer.appendSlice(self.alloc, doc.date);
+ try self.buffer.appendSlice(
+ self.alloc,
+ \\</pubDate>
+ \\<title>
+ );
+
+ try self.buffer.appendSlice(self.alloc, doc.title);
+ try self.buffer.appendSlice(
+ self.alloc,
+ \\</title>
+ \\</item>
+ );
+
+ // TODO: Add link
+ // TODO: Add guid (same as link)
+ // TODO: Add a description
+
+ return self.buffer.items;
+ }
+};
+
+test "rss formatter can format markdown document" {
+ const alloc = std.testing.allocator;
+ const doc =
+ \\---
+ \\title: A post title
+ \\date: 12 april 2026
+ \\---
+ \\# A post title
+ \\Aujourd'hui, mamam est morte.
+ ;
+
+ var formatter = RssFormatter.init(alloc);
+ defer formatter.deinit();
+
+ var mdDoc = try md.MarkdownDoc.parse(doc, alloc);
+ defer mdDoc.deinit(alloc);
+
+ const result = try formatter.format(mdDoc);
+
+ try std.testing.expectEqualStrings(
+ \\<item>
+ \\<pubDate>12 april 2026</pubDate>
+ \\<title>A post title</title>
+ \\</item>
+ ,
+ result
+ );
+}