Commit c6942ef03ed46a67bd9b3af8ce1eefd781622777

Martin Mitas 2024-01-10T17:31:55

Treat TABLECELLBOUNDARIES chain as special one. It's not an ordinary openers chain as (most of) the others, and md_rollback() must not touch it. Fixes #212.

diff --git a/src/md4c.c b/src/md4c.c
index 41ed5b4..cb57b2f 100644
--- a/src/md4c.c
+++ b/src/md4c.c
@@ -192,7 +192,7 @@ struct MD_CTX_tag {
 #define TILDE_OPENERS_2                         (ctx->mark_chains[10])
 #define BRACKET_OPENERS                         (ctx->mark_chains[11])
 #define DOLLAR_OPENERS                          (ctx->mark_chains[12])
-#define OPENERS_CHAIN_FIRST                     1
+#define OPENERS_CHAIN_FIRST                     2  /* [0] and [1] are special. */
 #define OPENERS_CHAIN_LAST                      12
 
     int n_table_cell_boundaries;
diff --git a/test/tables.txt b/test/tables.txt
index b220f66..cd62100 100644
--- a/test/tables.txt
+++ b/test/tables.txt
@@ -355,3 +355,25 @@ A | B
 </thead>
 </table>
 ````````````````````````````````
+
+
+### [Issue 212](https://github.com/mity/md4c/issues/212)
+
+```````````````````````````````` example
+x
+|-
+|[*x*]()
+.
+<table>
+<thead>
+<tr>
+<th>x</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><a href=""><em>x</em></a></td>
+</tr>
+</tbody>
+</table>
+````````````````````````````````