diff --git a/src/dialects/gruber.js b/src/dialects/gruber.js index a38d9348..f52f1df1 100644 --- a/src/dialects/gruber.js +++ b/src/dialects/gruber.js @@ -465,6 +465,12 @@ define(['../markdown_helpers', './dialect_helpers', '../parser'], function (Mark }, para: function para( block ) { + + // If the block starts with a HTML tag, don't wrap it in a para + if (block.match(/^<[^>]+\>/)) { + return this.processInline(block); + } + // everything's a para! return [ ["para"].concat( this.processInline( block ) ) ]; } diff --git a/src/parser.js b/src/parser.js index c6633be6..7525383b 100644 --- a/src/parser.js +++ b/src/parser.js @@ -88,10 +88,11 @@ define(['./markdown_helpers', './core'], function(MarkdownHelpers, Markdown) { //D:this.debug( "Testing", ord[i] ); var res = cbs[ ord[i] ].call( this, block, next ); if ( res ) { - //D:this.debug(" matched"); - if ( !isArray(res) || ( res.length > 0 && !( isArray(res[0]) ) ) ) - this.debug(ord[i], "didn't return a proper array"); - //D:this.debug( "" ); + + if ( !isArray(res) || ( res.length > 0 && !( isArray(res[0]) ) && ( typeof res[0] !== "string")) ) { + this.debug(ord[i], "didn't return proper JsonML"); + } + return res; } } diff --git a/test/features/linebreaks/html.json b/test/features/linebreaks/html.json new file mode 100644 index 00000000..08c1ed63 --- /dev/null +++ b/test/features/linebreaks/html.json @@ -0,0 +1,4 @@ +["html", + ["p", "This is a paragraph."], + "This is not in a paragraph" +] diff --git a/test/features/linebreaks/html.text b/test/features/linebreaks/html.text new file mode 100644 index 00000000..4b9523c7 --- /dev/null +++ b/test/features/linebreaks/html.text @@ -0,0 +1,3 @@ +This is a paragraph. + +This is not in a paragraph \ No newline at end of file