# Permissive WWW Autolinks With the flag `MD_FLAG_PERMISSIVEWWWAUTOLINKS`, MD4C enables recognition of autolinks starting with `www.`, even if they do not exactly follow the syntax of autolink as specified in CommonMark specification. These do not have to be enclosed in `<` and `>`, and they even do not need any preceding scheme specification. The WWW autolink will be recognized when the text `www.` is found followed by a valid domain. A valid domain consists of segments of alphanumeric characters, underscores (`_`) and hyphens (`-`) separated by periods (`.`). There must be at least one period, and no underscores may be present in the last two segments of the domain. The scheme `http` will be inserted automatically: ```````````````````````````````` example www.commonmark.org .
```````````````````````````````` After a valid domain, zero or more non-space non-`<` characters may follow: ```````````````````````````````` example Visit www.commonmark.org/help for more information. .Visit www.commonmark.org/help for more information.
```````````````````````````````` We then apply extended autolink path validation as follows: Trailing punctuation (specifically, `?`, `!`, `.`, `,`, `:`, `*`, `_`, and `~`) will not be considered part of the autolink, though they may be included in the interior of the link: ```````````````````````````````` example Visit www.commonmark.org. Visit www.commonmark.org/a.b. .Visit www.commonmark.org.
Visit www.commonmark.org/a.b.
```````````````````````````````` When an autolink ends in `)`, we scan the entire autolink for the total number of parentheses. If there is a greater number of closing parentheses than opening ones, we don't consider the last character part of the autolink, in order to facilitate including an autolink inside a parenthesis: ```````````````````````````````` example www.google.com/search?q=Markup+(business) (www.google.com/search?q=Markup+(business)) .www.google.com/search?q=Markup+(business)
(www.google.com/search?q=Markup+(business))
```````````````````````````````` This check is only done when the link ends in a closing parentheses `)`, so if the only parentheses are in the interior of the autolink, no special rules are applied: ```````````````````````````````` example www.google.com/search?q=(business))+ok .www.google.com/search?q=(business))+ok
```````````````````````````````` If an autolink ends in a semicolon (`;`), we check to see if it appears to resemble an [entity reference][entity references]; if the preceding text is `&` followed by one or more alphanumeric characters. If so, it is excluded from the autolink: ```````````````````````````````` example www.google.com/search?q=commonmark&hl=en www.google.com/search?q=commonmark&hl; .www.google.com/search?q=commonmark&hl=en
www.google.com/search?q=commonmark&hl;
```````````````````````````````` `<` immediately ends an autolink. ```````````````````````````````` example www.commonmark.org/heThis is link.
```````````````````````````````` ```````````````````````````````` example This is [link](www.github.com/)X .This is linkX
````````````````````````````````