In tests for checking aligment you use symbols '<' and '>' `result = t.image('!</imgs/myphoto.jpg!')` But in fact, these symbols was parsed in html special chars. Their looks like '\<' and '\>' . And therefore working only Simple way in pattern of reg exp function ```... \\! # opening ! (\<|\=|\>)? # optional alignment atts ... ``` replace by ``` ... \\! # opening ! (\<|\=|\>)? # optional alignment atts ... ``` and further `alignments = {'<': 'left', '=': 'center', '>': 'right'}` replace by `alignments = {'\<': 'left', '=': 'center', '\>': 'right'}` EDIT 2017-08-29 17:04 by @sebix: markup