md_process_verbatim_block_contents: Fix off by 1 error. This caused outputting wrong indentation inside a fenced code blocks for lines indented with mor ethan 16 spaces. Fixes #124.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 253a511..4148dd0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,8 @@ Fixes:
Fix HTML renderer's `MD_HTML_FLAG_VERBATIM_ENTITIES` flag, exposed in the
`md2html` utility via `--fverbatim-entities`.
+ * [#124](https://github.com/mity/md4c/issues/124):
+ Fix handling of indentation of 16 or more spaces in the fenced code blocks.
## Version 0.4.4
diff --git a/src/md4c.c b/src/md4c.c
index 4abd7aa..9fbc715 100644
--- a/src/md4c.c
+++ b/src/md4c.c
@@ -4579,9 +4579,9 @@ md_process_verbatim_block_contents(MD_CTX* ctx, MD_TEXTTYPE text_type, const MD_
MD_ASSERT(indent >= 0);
/* Output code indentation. */
- while(indent > (int) SIZEOF_ARRAY(indent_chunk_str)) {
+ while(indent > (int) indent_chunk_size) {
MD_TEXT(text_type, indent_chunk_str, indent_chunk_size);
- indent -= SIZEOF_ARRAY(indent_chunk_str);
+ indent -= indent_chunk_size;
}
if(indent > 0)
MD_TEXT(text_type, indent_chunk_str, indent);
diff --git a/test/coverage.txt b/test/coverage.txt
index cffdf63..8367759 100644
--- a/test/coverage.txt
+++ b/test/coverage.txt
@@ -266,6 +266,24 @@ foo
````````````````````````````````
+### [Issue 124](https://github.com/mity/md4c/issues/124)
+
+```````````````````````````````` example
+~~~
+ x
+~~~
+
+~~~
+ x
+~~~
+.
+<pre><code> x
+</code></pre>
+<pre><code> x
+</code></pre>
+````````````````````````````````
+
+
## Code coverage
### `md_is_unicode_whitespace__()`