Don't know, I always have a space before/after the --, I think some ancient browser broke if this wasn't the case. Not sure though, but I just do it by habit, removing the spaces should probably be OK and might be better for the parsing.
Also, only the code in the undo_markup should be added instead of replaced. Thus making sure that old posts are editable (is that a word? =]), but all new posts use the new markup.