get rid of bad markdown hooks
doc adjust
more careful treatment of outer modes

     - compare both ends
     - allow outer modes to be an intersection of spans returned
     by inner modes