tags:

views:

42

answers:

2

I have a large (~4GB) text file written in Multimarkdown format, and I would like to convert it to HTML.

I tried:

use strict;
use warnings;

use File::Map qw (map_file);
use Text::MultiMarkdown qw (markdown);

my $filename = shift // die;
map_file (my $text, $filename);
print markdown($text);

but it still chokes memory.

+1  A: 

You need to process the file in chunks, making sure the chunks end in ignorable whitespace (so as not to split lists and tables etc).

Provide more information regarding the structure and contents of the file to help us give you other useful pointers.

Sinan Ünür
Worth noting that if the document includes any of Multimarkdown's features like bibliographies and footnotes, weaving the parts back together will involve its own challenges.
FM