houseabsolute / Markdent

An event-based Markdown parser toolkit
http://metacpan.org/release/Markdent/
Other
12 stars 13 forks source link

Tabs in code blocks causes endless loops #25

Closed andrewalker closed 4 years ago

andrewalker commented 4 years ago

I have a large amount of markdown, and I'm experimenting with Markdent to manage it. It crashes every time there is a tab inside code blocks.

One liner to reproduce:

$ perl -MMarkdent::Simple::Fragment -e 'Markdent::Simple::Fragment->new->markdown_to_html(markdown => "```\n\tfoo\n```");'
About to enter an endless loop (pos = 0)!
    foo
autarch commented 4 years ago

This is definitely a bug, but I'd note that fenced code blocks aren't supported by the standard dialect. Even if the parser didn't error out, you wouldn't get the output you wanted. You need to use the dialects parameter:

Markdent::Simple::Fragment->new->markdown_to_html(markdown => "```\n\tfoo\n```", dialects => 'GitHub');
autarch commented 4 years ago

Thanks for the report. This is fixed in 0.38.