More lax support for Table headers
The separation row can now be separated with spaces from the column borders.
This commit is contained in:
parent
e2a3063b6e
commit
35a580ffce
1 changed files with 16 additions and 2 deletions
|
@ -1755,20 +1755,34 @@ parse_table_header(struct buf *ob, struct render *rndr, char *data, size_t size,
|
||||||
under_end++;
|
under_end++;
|
||||||
|
|
||||||
for (col = 0; col < *columns && i < under_end; ++col) {
|
for (col = 0; col < *columns && i < under_end; ++col) {
|
||||||
|
size_t dashes = 0;
|
||||||
|
|
||||||
|
while (i < under_end && (data[i] == ' ' || data[i] == '\t'))
|
||||||
|
i++;
|
||||||
|
|
||||||
if (data[i] == ':') {
|
if (data[i] == ':') {
|
||||||
i++; (*column_data)[col] |= MKD_TABLE_ALIGN_L;
|
i++; (*column_data)[col] |= MKD_TABLE_ALIGN_L;
|
||||||
|
dashes++;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (i < under_end && data[i] == '-')
|
while (i < under_end && data[i] == '-') {
|
||||||
i++;
|
i++; dashes++;
|
||||||
|
}
|
||||||
|
|
||||||
if (i < under_end && data[i] == ':') {
|
if (i < under_end && data[i] == ':') {
|
||||||
i++; (*column_data)[col] |= MKD_TABLE_ALIGN_R;
|
i++; (*column_data)[col] |= MKD_TABLE_ALIGN_R;
|
||||||
|
dashes++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (i < under_end && (data[i] == ' ' || data[i] == '\t'))
|
||||||
|
i++;
|
||||||
|
|
||||||
if (i < under_end && data[i] != '|')
|
if (i < under_end && data[i] != '|')
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if (dashes < 3)
|
||||||
|
break;
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue