ux/Showdown.js
[roojs1] / ux / Showdown.js
index 4997169..8de76db 100644 (file)
@@ -130,6 +130,8 @@ Roo.ux.Showdown.converter = function() {
             // contorted like /[ \t]*\n+/ .
             text = text.replace(/^[ \t]+$/mg,"");
     
+            text = _DoCodeBlcoks(text);
+    
             // Turn block-level HTML blocks into hash entries
             text = _HashHTMLBlocks(text);
     
@@ -345,6 +347,9 @@ Roo.ux.Showdown.converter = function() {
     // These are all the transformations that form block-level
     // tags like paragraphs, headers, and list items.
     //
+            // code blocks first... so content does not get translated..
+            text = _DoCodeBlocks(text);
+            
             text = _DoHeaders(text);
     
             // Do Horizontal Rules:
@@ -354,16 +359,16 @@ Roo.ux.Showdown.converter = function() {
             text = text.replace(/^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$/gm,key);
     
             text = _DoLists(text);
-            text = _DoCodeBlocks(text);
+    
             text = _DoBlockQuotes(text);
     
             // We already ran _HashHTMLBlocks() before, in Markdown(), but that
             // was to escape raw HTML in the original Markdown source. This time,
             // we're escaping the markup we've just created, so that we don't wrap
             // <p> tags around block-level tags.
-            text = _HashHTMLBlocks(text);
+           
             text = _FormParagraphs(text);
-    
+            text = _HashHTMLBlocks(text);
             return text;
     }
     
@@ -864,6 +869,7 @@ Roo.ux.Showdown.converter = function() {
             */
     
             // attacklab: sentinel workarounds for lack of \A and \Z, safari\khtml bug
+            text = text.replace(/~0/,"");
             text += "~0";
             
             text = text.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,
@@ -906,10 +912,7 @@ Roo.ux.Showdown.converter = function() {
             // attacklab: strip sentinel
             text = text.replace(/~0/, '');
 
-        
-    
-    
-    
+          
             return text;
     }