dg-x/lib/Classy/Simple.pm
snow flurry fb0d94a2c0 Add Markdent GFM extensions
- Per-image classes, to restrict what images a CSS selector acts on
  (in-post vs out-of-post)
- Fenced aside blocks (`!!!`-enclosed, like code blocks)
- Footnotes are handled by the Markdown parser, instead of manually
2024-10-05 17:24:16 -07:00

48 lines
923 B
Perl

package Classy::Simple;
use strict;
use warnings;
use namespace::autoclean;
our $VERSION = '0.10';
use Classy::Handler::Fragment;
use Params::ValidationCompiler qw( validation_for );
use Markdent::Parser;
use Markdent::Types;
use Moose;
with 'Markdent::Role::Simple';
{
# Validator from Markdent::Simple::Fragment
my $validator = validation_for(
params => [
dialects => {
type => t( 'ArrayRef', of => t('Str') ),
default => sub { [] },
},
markdown => { type => t('Str') },
],
named_to_list => 1,
);
sub markdown_to_html {
my $self = shift;
my ( $dialects, $markdown ) = $validator->(@_);
my $handler_class = 'Classy::Handler::Fragment';
return $self->_parse_markdown(
$markdown,
$dialects,
$handler_class,
);
}
}
1;
__END__