Skip to content

Commit

Permalink
Corrected the way link alt text is handled
Browse files Browse the repository at this point in the history
  • Loading branch information
andre-d committed Nov 23, 2011
1 parent 23d4fcd commit 7b42d86
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/markdown.c
Expand Up @@ -839,6 +839,7 @@ char_link(struct buf *ob, struct sd_markdown *rndr, uint8_t *data, size_t offset
struct buf *u_link = 0;
size_t org_work_size = rndr->work_bufs[BUFFER_SPAN].size;
int text_has_nl = 0, ret = 0;
int in_title = 0, qtype = 0;

/* checking whether the correct renderer exists */
if ((is_img && !rndr->cb.image) || (!is_img && !rndr->cb.link))
Expand Down Expand Up @@ -895,12 +896,15 @@ char_link(struct buf *ob, struct sd_markdown *rndr, uint8_t *data, size_t offset

/* looking for title end if present */
if (data[i] == '\'' || data[i] == '"') {
qtype = data[i];
in_title = 1;
i++;
title_b = i;

while (i < size) {
if (data[i] == '\\') i += 2;
else if (data[i] == ')') break;
else if (data[i] == qtype) {in_title = 0; i++;}
else if ((data[i] == ')') && !in_title) break;
else i++;
}

Expand Down

0 comments on commit 7b42d86

Please sign in to comment.