| 1 |
use strict; |
| 2 |
use warnings; |
| 3 |
use utf8; |
| 4 |
|
| 5 |
use Markdown::Perl; |
| 6 |
use Test2::V0; |
| 7 |
|
| 8 |
sub run { |
| 9 |
&Markdown::Perl::convert; |
| 10 |
} |
| 11 |
|
| 12 |
todo 'New lines are forbidden in link dest' => sub { |
| 13 |
# This fails because the inner brackets are parsed as HTML and the code does |
| 14 |
# not check for new-line inside non-text nodes, inside the span delimited by |
| 15 |
# the outer brackets (like it does if the link destination is not in |
| 16 |
# brackets). |
| 17 |
# Maybe it’s not a bug, because the CommonMark implementation itself considers |
| 18 |
# that <foo bar> is an HTML tag (which is probably not the correct way to |
| 19 |
# parse it, but the spec is unclear). |
| 20 |
is(run("[link](<dest <foo\nbar>>)"), "<p>[link](<dest <foo\nbar>>)</p>\n", 'newline in bracket in bracket in link'); |
| 21 |
}; |
| 22 |
|
| 23 |
todo 'Multi-line constructs mis-categorized as lazy paragraph continuation' => sub { |
| 24 |
is(run("> foo\n[ref]:\n/url\n"), "<blockquote>\n<p>foo\n</p></blockquote>\n<pre><code>bar\n</code></pre>\n", 'link reference definition is not lazy'); |
| 25 |
# Note that this fails only when the fenced_code_blocks_must_be_closed option |
| 26 |
# is set to true (our default, but not the cmark default). |
| 27 |
is(run("> foo\n```\nbar\n```"), "<blockquote>\n<p>foo</p>\n</blockquote>\n<pre><code>bar\n</code></pre>\n", 'fenced code is not lazy'); |
| 28 |
}; |
| 29 |
|
| 30 |
done_testing; |