evilstreak / markdown-js

A Markdown parser for javascript
7.69k stars 863 forks source link

Maruku dialect TypeError: Cannot read property 'splice' of undefined #253

Open aleray opened 8 years ago

aleray commented 8 years ago

Hi,

the following snippet raises a TypeError: Cannot read property 'splice' of undefined error. Not sure about what is going on exactly. The markdown below is a minimal example from a more complex case that initially triggered the error. Even the source text looks terrible, would be nice if markdown-js could not break.

var markdown = require( "markdown" ).markdown;
md_content = 'Foo: Bar  \n{: style=" key: value; }'
html_content = markdown.toHTML( md_content, 'Maruku');

Thanks,

chadananda commented 6 years ago

Weirdly, this error seems to occur whenever the first word in a line ends with a colon.

"foo: bar  \n{: .aclass }"  // error
"foo : bar \n{: .aclass }" // no error
markdown.min.js:1 Uncaught TypeError: Cannot read property 'splice' of undefined
    at m.u.block.block_meta (markdown.min.js:1)
    at m.processBlock (markdown.min.js:1)
    at m.toTree (markdown.min.js:1)
    at Object.m.parse (markdown.min.js:1)