further optimizations in MarkdownLevelSA()