package examples::markdown;
use Dancer ':syntax';
use strict;
use warnings;

my $have_text_markdown = 1 ;
eval {
	require Text::Markdown;
	require Template::Plugin::Markdown;
if ($@) {
	$have_text_markdown = 0 ;

Example of using "Text::Markdown" to render text to HTML.

1. "Text::Markdown" and "Template::Plugin::Markdown" are loaded dynamically,
   and if not found/not installed, this example still works (but rendering is not done).
   This allows users running the example Dancer/Bootstrap website without
   installing "Text::Markdown".

   In a production web-site, you can just require the installation of those modules,
   and skip this check.

2. The actual rendering is done *in the template file*, using the "Markdown" Filter.


my $markdown_text=<<EOF;

Hello From Markdown Text


* All standard Markdown features, such as
     * lists
     * headings
     * *bold*, _italics_, **strong bold**
     * code
     * Links


* [Basic Usage](
* [Full Syntax](
* [Wikipedia Page](


get '/markdown' => sub {
	template 'examples/markdown', {
				have_text_markdown => $have_text_markdown,
				text => $markdown_text