Skip to content

Commit

Permalink
md_analyze_permissive_autolink: Fix allowed nonalnum chars handling
Browse files Browse the repository at this point in the history
Partially fixes mity#251.
  • Loading branch information
Kaffeine committed Aug 2, 2024
1 parent 243316f commit 46c9492
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ 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.


## Version 0.5.2

Expand Down
4 changes: 2 additions & 2 deletions src/md4c.c
Original file line number Diff line number Diff line change
Expand Up @@ -3978,9 +3978,9 @@ 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)
((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)
((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)
Expand Down

0 comments on commit 46c9492

Please sign in to comment.