Skip to content
This repository was archived by the owner on Oct 30, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ test_requires 'Test::More' => '0.42';
test_requires 'Test::Exception' => undef;
test_requires 'List::MoreUtils' => undef;
test_requires 'Test::Differences' => undef;
test_requires 'Test::NoWarnings' => undef;
test_requires 'FindBin' => undef;

if ($Module::Install::AUTHOR) {
Expand Down
3 changes: 3 additions & 0 deletions lib/Text/Markdown.pm
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ sub urls {
sub _CleanUpDoc {
my ($self, $text) = @_;

# An empty file can end up getting passed as undef.
return "\n\n" unless defined $text;

# Standardize line endings:
$text =~ s{\r\n}{\n}g; # DOS to Unix
$text =~ s{\r}{\n}g; # Mac to Unix
Expand Down
9 changes: 9 additions & 0 deletions t/05empty_markdown.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use strict;
use warnings;
use Test::More tests => 3;
use Text::Markdown;
use Test::NoWarnings;

my $m = Text::Markdown->new;
ok $m->markdown(''), 'Parse empty string';
ok $m->markdown(undef), 'Parse undef';