-[NSAttributedString markdownRepresentation] doesn't escape Markdown characters.
This is a good test, but it's not exhaustive.
The code currently doesn't escape literals because the need to do so is contextual. You want to escape them when they occur in plain text, but you don't when they're not (e.g. a URL). I need solve that problem first - and it's subtly difficult one.
If someone enters the plain text my_variable_name = 1; is the intent to make "variable" italic? Will changing the text to my\_variable\_name = 1; be a welcome change? I'm still grappling with that...
I've added ESCAPE_ALL_LITERALS to convert all literals in rich text (including punctuation!). You'll probably find this irritating. Not only is text harder to read, it breaks many of the tests.
For example, the text above becomes:
I've added ESCAPE\_ALL\_LITERALS to convert all literals in rich text \(including punctuation\!\)\. You'll probably find this irritating\. Not only is text harder to read, it breaks many of the tests\.