Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ Fixes:
Fix handling tab when removing trailing whitespace, especially in connection
with ATX headers.

- [#251](https://github.com/mity/md4c/issues/251):
Fix handling of allowed non-alphanumeric characters in URL detection and
allow '+' in 'path' component.


## Version 0.5.2

Expand Down
8 changes: 5 additions & 3 deletions src/md4c.c
Original file line number Diff line number Diff line change
Expand Up @@ -3906,7 +3906,7 @@ md_analyze_permissive_autolink(MD_CTX* ctx, int mark_index)
const MD_CHAR optional_end_char;
} URL_MAP[] = {
{ _T('\0'), _T('.'), _T(".-_"), 2, _T('\0') }, /* host, mandatory */
{ _T('/'), _T('/'), _T("/.-_"), 0, _T('/') }, /* path */
{ _T('/'), _T('/'), _T("/.-+_"), 0, _T('/') }, /* path */
{ _T('?'), _T('&'), _T("&.-+_=()"), 1, _T('\0') }, /* query */
{ _T('#'), _T('\0'), _T(".-+_") , 1, _T('\0') } /* fragment */
};
Expand Down Expand Up @@ -3978,8 +3978,10 @@ md_analyze_permissive_autolink(MD_CTX* ctx, int mark_index)
} else if(end < line_end &&
ISANYOF(end, URL_MAP[i].allowed_nonalnum_chars) &&
md_scan_right_for_resolved_mark(ctx, right_cursor, end, &right_cursor) == NULL &&
((end > line_beg && (ISALNUM(end-1) || CH(end-1) == _T(')'))) || CH(end) == _T('(')) &&
((end+1 < line_end && (ISALNUM(end+1) || CH(end+1) == _T('('))) || CH(end) == _T(')')))
((end > line_beg && (ISALNUM(end-1) || ISANYOF(end-1, URL_MAP[i].allowed_nonalnum_chars)
|| CH(end-1) == _T(')'))) || CH(end) == _T('(')) &&
((end+1 < line_end && (ISALNUM(end+1) || ISANYOF(end+1, URL_MAP[i].allowed_nonalnum_chars)
|| CH(end+1) == _T('('))) || CH(end) == _T(')')))
{
if(CH(end) == URL_MAP[i].delim_char)
n_components++;
Expand Down