Fixes for quirky markdown parser behaviours

Overhaul of https://github.com/discourse/discourse/pull/2579

Fixes:

- nested inline tags: [b]strong [b]stronger[/b] [/b]
- additional newlines in bbcode list tags: [ul]\n[li]item[/li]\n[/ul]
- auto-quoting when the first " is preceded by a string containing a bracket: ["text"
- garbage or unmatched quote tags within quote blocks.

And this time, I've added tests and everything passes `rake qunit:test`. :smile:
This file comes from markdown-js so we need to make sure that all their tests pass and the commit is submitted upstream to them. Did you try it on their test suite?