Fix bug: embedded files not saved correctly (incorrect use of File API).
Fix bug: close bracket where it shouldn't be typo.
Fix bug: don't pass the output text through format_string(). It mangles the HTML.
Fix bug: don't pass the output string through format_text(). It mangles the HTML.