Fixes #1084

I tried to maintain the previous behaviour, the only things I changed is
that now it's not possibile to have the marker character inside the
marked string unless it's escaped with a backslash.

I also tried to dry things up but it would make the code more cryptic I
thought it would be better to leave things like that even with a little
bit of duplication