Skip to content

Commit

Permalink
implement rendering of supermd title attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
kristoff-it committed Aug 30, 2024
1 parent 9d4289b commit d8ab33c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
.version = "0.0.0",
.dependencies = .{
.supermd = .{
.url = "git+https://github.com/kristoff-it/supermd#50a76de16fa2942e9d1d00100661d17b4ce3cc5a",
.hash = "1220929ddb502ff2616b1621ad7ff93a36c772a0961507437726186c33582233923c",
.url = "git+https://github.com/kristoff-it/supermd#ff1bc012b4ae868f23b4552f7bd19065a8a3b8bd",
.hash = "1220785eaa913e7cd55e2901512ac1be6b2bd1ed4b199967271b89ea4d722f81a3a9",
},
.scripty = .{
.url = "git+https://github.com/kristoff-it/scripty#df8c11380f9e9bec34809f2242fb116d27cf39d6",
Expand Down
4 changes: 4 additions & 0 deletions src/render/html.zig
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ fn renderDirective(
for (attrs) |attr| try w.print("{s} ", .{attr});
try w.print("\"", .{});
}
if (directive.title) |t| try w.print(" title=\"{s}\"", .{t});
try w.print(" src=\"{s}\"", .{img.src.?.url});
if (img.alt) |alt| try w.print(" alt=\"{s}\"", .{alt});
try w.print(">", .{});
Expand All @@ -354,6 +355,7 @@ fn renderDirective(
for (attrs) |attr| try w.print("{s} ", .{attr});
try w.print("\"", .{});
}
if (directive.title) |t| try w.print(" title=\"{s}\"", .{t});
if (vid.loop) |val| if (val) try w.print(" loop", .{});
if (vid.autoplay) |val| if (val) try w.print(" autoplay", .{});
if (vid.muted) |val| if (val) try w.print(" muted", .{});
Expand Down Expand Up @@ -382,6 +384,7 @@ fn renderDirective(
try w.print("\"", .{});
}

if (directive.title) |t| try w.print(" title=\"{s}\"", .{t});
try w.print(" href=\"{s}", .{lnk.src.?.url});
if (lnk.ref) |r| try w.print("#{s}", .{r});
try w.print("\"", .{});
Expand All @@ -402,6 +405,7 @@ fn renderDirective(
for (attrs) |attr| try w.print("{s} ", .{attr});
}

if (directive.title) |t| try w.print(" title=\"{s}\"", .{t});
try w.print("><code class=\"{?s}\">", .{code.language});

// In this case src.url contains the prerendered source code
Expand Down

0 comments on commit d8ab33c

Please sign in to comment.