From 4022ff9578b4fbcb64f3896702d74529f92c7608 Mon Sep 17 00:00:00 2001 From: WormHeamer Date: Wed, 14 May 2025 22:39:39 -0400 Subject: add inline links --- main.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 5aa7a9e..7743de8 100644 --- a/main.c +++ b/main.c @@ -356,9 +356,22 @@ void markup_inline(InlineState *ms, Str *out, Str src, Arena *scratch, Arena *pe str_catc_html(out, src.s[i], perm); } } else { + Str skp = str_skip(src, i); if (c == '`') im_op(ms, out, IM_CODE, scratch, perm); else if (c == '*') im_tog(ms, out, IM_ITAL, scratch, perm); - else if (str_starts(str_skip(src, i), S("---"))) { + else if (str_starts(skp, S("[["))) { + skp = str_skip(skp, 2); + Str f = str_find(skp, S("]]")); + Str lnks = { skp.s, f.n ? f.s - skp.s : skp.n }; + Cut lnk = str_cut(lnks, '|'); + str_cat(out, S(""), perm); + if (!f.n) break; + i = f.s - src.s + 2; + } else if (str_starts(skp, S("---"))) { str_cat(out, S("—"), perm); i += 2; } else { @@ -510,7 +523,7 @@ void usage(const char *cmd) { " -c --css embed the given file within a