TMTOWTDI

*$ cat md*
#!/usr/bin/env perl
use Mojolicious::Lite;

use Text::Markdown;

helper md => sub { shift; Text::Markdown->new->markdown(@_) };

get '/readme' => sub {
  my $c = shift;
  $c->render(text => $c->md(Mojo::Util::slurp 'README.md'));
};

app->start;

*$ cat README.md *
# Hello


*$ perl md get /readme*
*[Mon Mar 28 09:26:17 2016] [debug] GET "/readme"*
*[Mon Mar 28 09:26:17 2016] [debug] Routing to a callback*
*[Mon Mar 28 09:26:17 2016] [debug] 200 OK (0.002154s, 464.253/s)*
*<h1>Hello</h1>*


On Mon, Mar 28, 2016 at 6:50 AM, Pavel Serikov <[email protected]>
wrote:

> I want that my README.md will be available under */**readme* route. How
> to do that?
>
> I checked the docs
> <http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Serving-static-files>
> about ways of serving static files, but problem that I need to process
> markdown to html firstly. It's possible to do with Text::Markdown
> <https://metacpan.org/pod/Text::Markdown> or other plugins, but how to
> use it together with reply->static
> <http://mojolicious.org/perldoc/Mojolicious/Plugin/DefaultHelpers#reply-static>
> helper?
> Or maybe there is ready-to-use plugin? I found
> Mojolicious::Plugin::Directory
> <https://metacpan.org/pod/Mojolicious::Plugin::Directory>, but seems like
> it serve all static files, but I need to serve only one.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Mojolicious" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/mojolicious.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to