Skip to content

Commit

Permalink
md_process_verbatim_block_contents: Fix off by 1 error.
Browse files Browse the repository at this point in the history
This caused outputting wrong indentation inside a fenced code blocks for
lines indented with mor ethan 16 spaces.

Fixes #124.
  • Loading branch information
mity committed Jul 30, 2020
1 parent 470b42c commit c595c2e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/md4c.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
18 changes: 18 additions & 0 deletions test/coverage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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__()`
Expand Down

0 comments on commit c595c2e

Please sign in to comment.