Skip to content
This repository was archived by the owner on Oct 30, 2023. It is now read-only.

Conversation

@tokuhirom
Copy link

markdown with xslate.

This is a example failing code:

use strict;
use warnings;
use utf8;
use File::Spec;
use File::Basename;
use lib File::Spec->catdir(dirname(__FILE__), 'extlib', 'lib', 'perl5');
use lib File::Spec->catdir(dirname(__FILE__), 'lib');
use Plack::Builder;
use Amon2::Lite;

use Text::Xslate qw/html_builder mark_raw/;
use Text::Markdown qw/markdown/;

sub config {
    +{
        'Text::Xslate' => {
            'function' => {
                markdown     => html_builder { Text::Markdown::markdown(@_) },
            },
        }
    }
}

get '/markdown_sample' => sub { $_[0]->render('markdown_sample.tx')  };

builder {
    enable 'Plack::Middleware::Static',
        path => qr{^(?:/static/|/robot\.txt$|/favicon\.ico$)},
        root => File::Spec->catdir(dirname(__FILE__));
    enable 'Plack::Middleware::ReverseProxy';
    enable 'Plack::Middleware::Session';

    __PACKAGE__->to_app();
};

__DATA__
@@ markdown_sample.tx
<!doctype html>
<html>
<body>

<pre>
[% FILTER markdown %]
    [% INCLUDE 'docs.txt' %]
[% END %]
</pre>

</body>
</html>

@@ docs.txt
text

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant