Partial Fix #5654 - roojspacker - get it working as a doc tool...
[roojs1] / Roo / Markdown.js
index ae8f068..de54b7c 100644 (file)
@@ -32,7 +32,9 @@ Roo.Markdown.toHtml = function(text) {
             smartLists: true,
             smartypants: false
           });
-
+    // A FEW HACKS!!?
+    
+    text = text.replace(/\\\n/g,' ');
     return Roo.Markdown.marked(text);
 };
 //
@@ -136,7 +138,7 @@ Roo.Markdown.toHtml = function(text) {
      * Block Lexer
      */
     
-    function Lexer(options) {
+    var Lexer = function (options) {
       this.tokens = [];
       this.tokens.links = {};
       this.options = options || marked.defaults;
@@ -554,7 +556,7 @@ Roo.Markdown.toHtml = function(text) {
      * Inline Lexer & Compiler
      */
     
-    function InlineLexer(links, options) {
+    var InlineLexer = function (links, options) {
       this.options = options || marked.defaults;
       this.links = links;
       this.rules = inline.normal;
@@ -794,7 +796,7 @@ Roo.Markdown.toHtml = function(text) {
      * Renderer
      */
     
-    function Renderer(options) {
+    var Renderer = function (options) {
       this.options = options || {};
     }
     
@@ -863,7 +865,7 @@ Roo.Markdown.toHtml = function(text) {
     };
     
     Renderer.prototype.table = function(header, body) {
-      return '<table>\n'
+      return '<table class="table table-striped">\n'
         + '<thead>\n'
         + header
         + '</thead>\n'
@@ -944,7 +946,7 @@ Roo.Markdown.toHtml = function(text) {
      * Parsing & Compiling
      */
     
-    function Parser(options) {
+    var Parser = function (options) {
       this.tokens = [];
       this.token = null;
       this.options = options || marked.defaults;
@@ -1124,7 +1126,7 @@ Roo.Markdown.toHtml = function(text) {
      * Helpers
      */
     
-    function escape(html, encode) {
+    var escape = function (html, encode) {
       return html
         .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&amp;')
         .replace(/</g, '&lt;')
@@ -1133,7 +1135,7 @@ Roo.Markdown.toHtml = function(text) {
         .replace(/'/g, '&#39;');
     }
     
-    function unescape(html) {
+    var unescape = function (html) {
         // explicitly match decimal, hex, and named HTML entities 
       return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/g, function(_, n) {
         n = n.toLowerCase();
@@ -1147,7 +1149,7 @@ Roo.Markdown.toHtml = function(text) {
       });
     }
     
-    function replace(regex, opt) {
+    var replace = function (regex, opt) {
       regex = regex.source;
       opt = opt || '';
       return function self(name, val) {
@@ -1159,7 +1161,7 @@ Roo.Markdown.toHtml = function(text) {
       };
     }
     
-    function noop() {}
+    var noop = function () {}
     noop.exec = noop;
     
     function merge(obj) {
@@ -1184,7 +1186,7 @@ Roo.Markdown.toHtml = function(text) {
      * Marked
      */
     
-    function marked(src, opt, callback) {
+    var marked = function (src, opt, callback) {
       if (callback || typeof opt === 'function') {
         if (!callback) {
           callback = opt;
@@ -1241,7 +1243,7 @@ Roo.Markdown.toHtml = function(text) {
               return --pending || done();
             }
             return highlight(token.text, token.lang, function(err, code) {
-              if (err) return done(err);
+              if (err) { return done(err); }
               if (code == null || code === token.text) {
                 return --pending || done();
               }
@@ -1255,7 +1257,7 @@ Roo.Markdown.toHtml = function(text) {
         return;
       }
       try {
-        if (opt) opt = merge({}, marked.defaults, opt);
+        if (opt) { opt = merge({}, marked.defaults, opt); }
         return Parser.parse(Lexer.lex(src, opt), opt);
       } catch (e) {
         e.message += '\nPlease report this to https://github.com/chjj/marked.';