fix doc formatting by doing CGI escaping after doc/code separation phase