*/
-//
-// marked usage:
-//
-// alert( Roo.Markdown.toHtml("Markdown *rocks*.") );
-//
-// Note: move the sample code to the bottom of this
-// file before uncommenting it.
-//
-
+/**
+ *
+ * Roo.Markdown - is a very crude wrapper around marked..
+ *
+ * usage:
+ *
+ * alert( Roo.Markdown.toHtml("Markdown *rocks*.") );
+ *
+ * Note: move the sample code to the bottom of this
+ * file before uncommenting it.
+ *
+ */
-//
-// Showdown namespace
-//
Roo.Markdown = {};
Roo.Markdown.toHtml = function(text) {
- var c = new Roo.ux.Markdown.marked.setOptions({
- renderer: new Roo.ux.Showdown.marked.Renderer(),
+ var c = new Roo.Markdown.marked.setOptions({
+ renderer: new Roo.Markdown.marked.Renderer(),
gfm: true,
tables: true,
breaks: false,
smartLists: true,
smartypants: false
});
-
+ // A FEW HACKS!!?
+
+ text = text.replace(/\\\n/g,' ');
return Roo.Markdown.marked(text);
};
//
loose = next || /\n\n(?!\s*$)/.test(item);
if (i !== l - 1) {
next = item.charAt(item.length - 1) === '\n';
- if (!loose) loose = next;
+ if (!loose) { loose = next; }
}
this.tokens.push({
? this.options.sanitizer
? this.options.sanitizer(cap[0])
: escape(cap[0])
- : cap[0]
+ : cap[0];
continue;
}
*/
InlineLexer.prototype.smartypants = function(text) {
- if (!this.options.smartypants) return text;
+ if (!this.options.smartypants) { return text; }
return text
// em-dashes
.replace(/---/g, '\u2014')
*/
InlineLexer.prototype.mangle = function(text) {
- if (!this.options.mangle) return text;
+ if (!this.options.mangle) { return text; }
var out = ''
, l = text.length
, i = 0
};
Renderer.prototype.table = function(header, body) {
- return '<table>\n'
+ return '<table class="table table-striped">\n'
+ '<thead>\n'
+ header
+ '</thead>\n'
// explicitly match decimal, hex, and named HTML entities
return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/g, function(_, n) {
n = n.toLowerCase();
- if (n === 'colon') return ':';
+ if (n === 'colon') { return ':'; }
if (n.charAt(0) === '#') {
return n.charAt(1) === 'x'
? String.fromCharCode(parseInt(n.substring(2), 16))
regex = regex.source;
opt = opt || '';
return function self(name, val) {
- if (!name) return new RegExp(regex, opt);
+ if (!name) { return new RegExp(regex, opt); }
val = val.source || val;
val = val.replace(/(^|[^\[])\^/g, '$1');
regex = regex.replace(name, val);
delete opt.highlight;
- if (!pending) return done();
+ if (!pending) { return done(); }
for (; i < tokens.length; i++) {
(function(token) {
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();
}
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.';