aboutsummaryrefslogtreecommitdiff
path: root/src/link.zig
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <william@herges.fr>2026-04-26 23:10:17 +0200
committerAnhgelus Morhtuuzh <william@herges.fr>2026-04-26 23:17:26 +0200
commitde948492e8b38a79d5db9c506c1b7b82e86c6b12 (patch)
tree122e4c004d37193c64d6b8b89d9a252f7e237cfa /src/link.zig
parentae6ee68d6f4ef79fef609b4d09b543fc06326e95 (diff)
feat(): support code block
Diffstat (limited to 'src/link.zig')
-rw-r--r--src/link.zig26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/link.zig b/src/link.zig
index 9bfbde5..ef92b1c 100644
--- a/src/link.zig
+++ b/src/link.zig
@@ -19,20 +19,18 @@ pub fn parse(alloc: Allocator, l: *Lexer) Error!Element {
if (!eql(u8, v.content, "[")) return (try Element.Literal.init(alloc, v.content)).element();
var el = try Element.Empty.init(alloc);
errdefer el.deinit(alloc);
- while (l.peek()) |next| {
- switch (next.kind) {
- .weak_delimiter, .strong_delimiter => return Error.InvalidLink,
- .link => {
- l.consume();
- if (!eql(u8, next.content, "](")) return Error.InvalidLink;
- break;
- },
- else => {
- const in = try content.parse(alloc, l);
- try el.content.append(alloc, in);
- },
- }
- }
+ while (l.peek()) |next| switch (next.kind) {
+ .weak_delimiter, .strong_delimiter => return Error.InvalidLink,
+ .link => {
+ l.consume();
+ if (!eql(u8, next.content, "](")) return Error.InvalidLink;
+ break;
+ },
+ else => {
+ const in = try content.parse(alloc, l);
+ try el.content.append(alloc, in);
+ },
+ };
const href = l.next() orelse return Error.InvalidLink;
if (href.kind != .literal) return Error.InvalidLink;
const finisher = l.next() orelse return Error.InvalidLink;