diff --git a/src/browser/markdown.zig b/src/browser/markdown.zig index 437dbee6..b513b057 100644 --- a/src/browser/markdown.zig +++ b/src/browser/markdown.zig @@ -300,9 +300,11 @@ const Context = struct { try self.renderChildren(el.asNode()); if (href) |h| { if (!self.state.last_char_was_newline) try self.writer.writeByte('\n'); - try self.writer.writeAll("([]("); + try self.writer.writeByte('['); + try self.writer.writeAll(label orelse h); + try self.writer.writeAll("]("); try self.writer.writeAll(h); - try self.writer.writeAll("))\n"); + try self.writer.writeAll(")\n"); self.state.last_char_was_newline = true; } return; @@ -589,7 +591,39 @@ test "browser.markdown: block link" { \\### Title \\ \\Description - \\([](https://example.com)) + \\[https://example.com](https://example.com) + \\ + ); +} + +test "browser.markdown: block link with aria-label" { + try testMarkdownHTML( + \\ + \\

Title

+ \\

Description

+ \\
+ , + \\ + \\### Title + \\ + \\Description + \\[Docs](https://example.com) + \\ + ); +} + +test "browser.markdown: block link with title" { + try testMarkdownHTML( + \\ + \\

Title

+ \\

Description

+ \\
+ , + \\ + \\### Title + \\ + \\Description + \\[Docs](https://example.com) \\ ); }