From 0e1268eaad117ec6174074787b5ad08b6f233987 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Tue, 31 Dec 2024 17:04:42 +0200 Subject: feat(single): Implement inline code block --- single.awk | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'single.awk') diff --git a/single.awk b/single.awk index 9195576..65883f7 100644 --- a/single.awk +++ b/single.awk @@ -13,8 +13,8 @@ # [ ] Links # [ ] Inline # [ ] Reference -# [ ] Code # [x] Emphasis +# [x] Code # [ ] Images # [ ] Inline # [ ] Reference @@ -156,8 +156,9 @@ function sub_match(replacement) { } function surround(brace, left, right, blen) { if (blen == "") { blen = length(brace) } - if (match($0, brace "[^" brace "]+" brace)) { + if (match($0, brace (brace == "``" ? "." : "[^" brace "]") "+" brace)) { elem = left substr($0, RSTART + blen, RLENGTH - 2*blen) right + if (brace == "``") { gsub("`", "\\`", elem) } sub_match(elem) return 1; } @@ -185,6 +186,8 @@ function gsurround(brace, left, right, blen) { gsurround("_" , "" , "") gsurround("\\*\\*", "", "", 2) gsurround("\\*" , "" , "", 1) + gsurround("``" , "" , "") + gsurround("`" , "" , "") } # Paragraph -- cgit v1.3.1-26-gb76a