add(zmd): parse markdown file contents and display the parsed contents
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 44s

Not everything can be parsed and displayed correctly yet, however this
will the default file format to use for adding page contents (i.e.
normal pages, blog entries, etc.)
This commit is contained in:
2024-10-13 12:57:44 +02:00
parent 2db1d55fcf
commit a01619911d
6 changed files with 184 additions and 50 deletions

View File

@@ -33,18 +33,6 @@ pub fn deinit(this: *@This()) void {
fn fillView(this: *@This()) void {
this.view.?.clear();
if (this.path) |path| {
for (0..path.len, this.view.?.screen.width / 2 - path.len / 2..) |i, col| {
const cell: vaxis.Cell = .{
.char = .{ .grapheme = path[i .. i + 1] },
.style = .{
.ul_style = .single,
},
};
this.view.?.writeCell(col, 0, cell);
}
}
const msg = "Yves Biener";
for (msg, 0..) |_, i| {
const cell: vaxis.Cell = .{
@@ -58,8 +46,22 @@ fn fillView(this: *@This()) void {
.bold = true,
},
};
this.view.?.writeCell(this.view.?.screen.width - msg.len - 3 + i, 0, cell);
this.view.?.writeCell(i + 1, 0, cell);
}
if (this.path) |path| {
for (0..path.len, this.view.?.screen.width / 2 - path.len / 2..) |i, col| {
const cell: vaxis.Cell = .{
.char = .{ .grapheme = path[i .. i + 1] },
.style = .{
.ul_style = .single,
},
};
this.view.?.writeCell(col, 0, cell);
}
}
// TODO: github icon, discord icon, mail icon with corresponding links to contact me
}
/// Update loop for a given widget to react to the provided `Event`. It may