I would like to use the current C version of Fletcher Penny's Multi-markdown as a filter in Template Toolkit. It's not clear to me how to set this up.
At present I'm not calling TT as a module, but simply writing templates that are called with tpage and ttree.
Template-Toolkit filters are actually quite easy to write.
Module:
package Template::Plugin::Filter::MultiMarkdown;
use strict;
use warnings;
our @ISA = 'Template::Plugin::Filter';
sub init {
my $self = shift;
$self->install_filter('markdown');
return $self;
}
sub filter {
my ($self, $text) = @_;
... Code that transforms $text and returns the transformed text ...
}
1;
Usage:
[% USE Filter.MultiMarkdown %]
[% FILTER markdown %]...[% END %]
-or-
[% ... | markdown %]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With