fix wrong file mode
Trim line break at end of markup
Fix code block handling bug