Here's a wiki page (a fragment of my user manual) with exactly 40,000 characters:
The HTML is correctly parsed: it has proper formatting, the links work, etc.
Here's the same page, but with one more character:
Note that none of the HTML is parsed, presumably due to exceeding a hard-coded buffer size somewhere in the markdown parser.
This is new behavior, as of May 2013. I know this because my user manual was always bigger than 40KB, but the HTML didn't stop working until this month, maybe even as recently as this week.
Opinion: This is a very silly and avoidable bug. In the age of 64-bit addressing and string containers, it's hard to see why any aspect of the markdown parser should be limited to 40KB or any other particular number.
While we're fixing this, any chance of doing something about the lame handling of definition lists in markdown? (issue #57, from February)
Looks like this is due to the behavior added in [#5607]. Cory said he has some ideas or alternative implementation though.