using Markdown as a perl module

Daniel Axelrod markdown at danonline.net
Wed May 12 21:39:09 EDT 2004


On Wednesday, May 12, 2004, at 02:25  PM, Angie Ahl wrote:
>> I haven't tried it, but Markdown::Markdown($ItemText)
>> might work.
> That's what I thought. It was just wishful thinking.
I read this, and thought, "No, there has to be a way!" Sure enough, I 
seem to have found one. I've gotten it to work with Markdown 1.0b4 
using this code:

  use lib '/path/to/markdown/directory';
  $blosxom::version = 1; #Spoof Blosxom
  require 'Markdown.pl';
  my $marked_down = Markdown::Markdown($text);

The string on the first line should be changed to the path to the 
directory containing the Markdown.pl file.

The second line makes Markdown think Blosxom is being used, so it 
doesn't try to process command-line output.

Does this work for you, too? If not, I'll see what else I can come up 
with.

> I have Grep, I can change those vars to my, I can write bless. I can 
> try.... and possibly fail
Yeah, this is what made me try to come up with a better way; there 
should be some way to use Markdown in your program without trying to 
parse its code and modifying every version that comes out.

> Of course I'm no perl guru yet, but my understanding of it is I never 
> will be unless I hack at cool code ;)
You just taught me something!

-Daniel Axelrod



More information about the Markdown-discuss mailing list