move code block implementation, remove redundant <br>s, add paragraph for top level text chunks
remove the redundant <br> in header, fix bug of paragraph consuming header