Skip to content

Commit

Permalink
md_collect_marks: Improve pre-test for '.'.
Browse files Browse the repository at this point in the history
  • Loading branch information
mity committed Jan 22, 2024
1 parent 23e7929 commit 2cb4f23
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/md4c.c
Original file line number Diff line number Diff line change
Expand Up @@ -3245,7 +3245,9 @@ md_collect_marks(MD_CTX* ctx, const MD_LINE* lines, int n_lines, int table_mode)

/* A potential permissive WWW autolink. */
if(ch == _T('.')) {
if(line->beg + 3 <= off && md_ascii_eq(STR(off-3), _T("www"), 3)) {
if(line->beg + 3 <= off && md_ascii_eq(STR(off-3), _T("www"), 3) &&
(off-3 == line->beg || ISUNICODEWHITESPACEBEFORE(off-3) || ISUNICODEPUNCTBEFORE(off-3)))
{
ADD_MARK(ch, off-3, off+1, MD_MARK_POTENTIAL_OPENER);
/* Push a dummy as a reserve for a closer. */
ADD_MARK('D', line->beg, line->end, 0);
Expand Down

0 comments on commit 2cb4f23

Please sign in to comment.