diff options
Diffstat (limited to 'src/inlines.c')
-rw-r--r-- | src/inlines.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/inlines.c b/src/inlines.c index ea4d3c5..bf55a0f 100644 --- a/src/inlines.c +++ b/src/inlines.c @@ -782,25 +782,26 @@ match: *last = inl; // process_emphasis will remove this delimiter and all later ones. - // Now we also remove earlier ones of the same kind - // (so, no links in links, and no images in images): - // (This code can be removed if we decide to allow links - // inside links and images inside images): - opener = subj->delimiters; - closer_above = NULL; - while (opener != NULL) { - tempstack = opener->previous; - if (opener->delim_char == (is_image ? '!' : '[')) { - free(opener); - if (closer_above) { - closer_above->previous = tempstack; + // Now, if we have a link, we also want to remove earlier link + // delimiters. (This code can be removed if we decide to allow links + // inside links.) + if (!is_image) { + opener = subj->delimiters; + closer_above = NULL; + while (opener != NULL) { + tempstack = opener->previous; + if (opener->delim_char == '[') { + free(opener); + if (closer_above) { + closer_above->previous = tempstack; + } else { + subj->delimiters = tempstack; + } } else { - subj->delimiters = tempstack; + closer_above = opener; } - } else { - closer_above = opener; + opener = tempstack; } - opener = tempstack; } return NULL; |