From 8c0cdf65f6a499d14ff254d64f7ce2c79b18e228 Mon Sep 17 00:00:00 2001 From: Alex Karle Date: Sat, 18 Dec 2021 14:07:44 -0500 Subject: [PATCH] Fix escaping of inline markup in code blocks The tests are making this easy to identify -- time well spent :) --- blag.c | 6 +++--- test/big.html | 5 +++++ test/big.txt | 3 +++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/blag.c b/blag.c index c5f2c30..c6480f2 100644 --- a/blag.c +++ b/blag.c @@ -214,7 +214,7 @@ int parse() { } break; case '`': - if (s.in_link == NONE) { + if (s.in_link == NONE && s.in != CODE) { if (s.in_code) { printf(""); s.in_code = 0; @@ -225,7 +225,7 @@ int parse() { } break; case '*': - if (!s.in_code && s.in_link == NONE) { + if (!s.in_code && s.in_link == NONE && s.in != CODE) { if (s.in_bold) { printf(""); s.in_bold = 0; @@ -238,7 +238,7 @@ int parse() { } break; case '_': - if (!s.in_code && s.in_link == NONE) { + if (!s.in_code && s.in_link == NONE && s.in != CODE) { if (s.in_ital) { printf(""); s.in_ital = 0; diff --git a/test/big.html b/test/big.html index 9b00c17..a8109b9 100644 --- a/test/big.html +++ b/test/big.html @@ -64,9 +64,14 @@ my gopherhole.
 $ this is a code block
+$ *bold* and _italics_ and code have no effect!
 $ git status
 

+<html> is escaped! +

+ +

cheers!

diff --git a/test/big.txt b/test/big.txt index 4027573..b5a0dba 100644 --- a/test/big.txt +++ b/test/big.txt @@ -27,6 +27,9 @@ my [gopher://alexkarle.com gopherhole]. > that wraps! $ this is a code block + $ *bold* and _italics_ and `code` have no effect! $ git status + is escaped! + cheers! -- libgit2 1.1.1