diff options
| Commit | 0e1268eaad117ec6174074787b5ad08b6f233987 (patch) | |
|---|---|---|
| Author | 2024-12-31 17:04:42 +0200 | |
| Committer | 2024-12-31 17:04:42 +0200 | |
| Files | d988edf41639d5827b54a2cc6721b7d0fb695107 /single.awk | |
| csg-0e1268eaad117ec6174074787b5ad08b6f233987.tar csg-0e1268eaad117ec6174074787b5ad08b6f233987.tar.gz csg-0e1268eaad117ec6174074787b5ad08b6f233987.zip | ||
| Parent | ade38ab69c5fe8cd7e35395582addac9e037bc3f (diff) | |
feat(single): Implement inline code block
1 files changed, 5 insertions, 2 deletions
| -rw-r--r-- | single.awk | 7 |
@@ -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("_" , "<em>" , "</em>") gsurround("\\*\\*", "<strong>", "</strong>", 2) gsurround("\\*" , "<em>" , "</em>", 1) + gsurround("``" , "<code>" , "</code>") + gsurround("`" , "<code>" , "</code>") } # Paragraph |
