             html = wysiwygService.getHTML(markdown)
             editorMedium.html(html)
             wysiwygCodeHightlighterService.addHightlighter(mediumInstance.elements[0])
-            refreshCodeBlocks(mediumInstance)
+
+            if $scope.editMode
+                refreshCodeBlocks(mediumInstance)
 
         $scope.saveSnippet = (lan, code) ->
             $scope.codeEditorVisible = false

                pre.nextElementSibling.appendChild(document.createElement('br'))

            # add p after every pre
            else if !pre.nextElementSibling || pre.nextElementSibling.nodeName.toLowerCase() != 'p'
                p = document.createElement('p')
                p.appendChild(document.createElement('br'))


            if $scope.mode == 'html'
                updateMarkdownWithCurrentHtml()

            setHtmlMedium($scope.markdown)

            return if $scope.required && !$scope.markdown.length

