summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/commonmark.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/commonmark.c b/src/commonmark.c
index 6994ed1..17a89ab 100644
--- a/src/commonmark.c
+++ b/src/commonmark.c
@@ -254,6 +254,7 @@ S_render_node(cmark_node *node, cmark_event_type ev_type,
const char *info;
const char *title;
char listmarker[64];
+ char *emph_delim;
int marker_width;
state->in_tight_list_item =
@@ -434,10 +435,18 @@ S_render_node(cmark_node *node, cmark_event_type ev_type,
break;
case CMARK_NODE_EMPH:
+ // If we have EMPH(EMPH(x)), we need to use *_x_*
+ // because **x** is STRONG(x):
+ if (node->parent && node->parent->type == CMARK_NODE_EMPH &&
+ node->next == NULL && node->prev == NULL) {
+ emph_delim = "_";
+ } else {
+ emph_delim = "*";
+ }
if (entering) {
- lit(state, "*", false);
+ lit(state, emph_delim, false);
} else {
- lit(state, "*", false);
+ lit(state, emph_delim, false);
}
break;