Dancer::Plugin::Preprocess::Markdown - Generate HTML content from Markdown files
version 0.021
Dancer::Plugin::Preprocess::Markdown automatically generates HTML content from Markdown files in a Dancer web application.
Add the plugin to your application:
use Dancer::Plugin::Preprocess::Markdown;
Configure its settings in the YAML configuration file:
plugins: "Preprocess::Markdown": save: 1 paths: "/documents": recursive: 1 save: 0 "/articles": src_dir: "articles/markdown" dest_dir: "articles/html" layout: "article"
Dancer::Plugin::Preprocess::Markdown generates HTML content from Markdown source files.
When an HTML file is requested, and its path matches one of the paths specified in the configuration, the plugin looks for a corresponding Markdown file and processes it to produce the HTML content. The generated HTML file may then be saved and re-used with subsequent requests for the same URL.
The available configuration settings are described below.
The layout used to display the generated HTML content.
A collection of paths that will be served by the plugin. Each path entry may define path-specific settings that override top-level settings.
If set to 0, then the plugin only processes files placed in the source directory and not its subdirectories. If set to 1, subdirectories are also processed.
0
1
Default: 0
If set to 0, then the HTML content is generated on-the-fly with every request. If set to 1, then HTML files are generated once and saved, and are used in subsequent responses. The files are regenerated every time the source Markdown files are modified.
The directory where source Markdown files are located.
Default: md/src/{path}
md/src/{path}
The destination directory for the generated HTML files (if the save option is in use).
save
Default: md/dest/{path}
md/dest/{path}
If there's a route defined in your application that matches one of the paths served by the plugin, it will take precedence. For example, with the following configuration:
plugins: "Preprocess::Markdown": paths: "/documents": ...
and this route in the application:
get '/documents/faq' => sub { ... };
A request for /documents/faq won't be processed by the plugin, but by the handler defined in the application.
/documents/faq
Text::Markdown
Markdown Homepage
Markdown to HTML conversion is done with Text::Markdown, written by Tomas Doran.
Please report any bugs or feature requests through the issue tracker at https://github.com/odyniec/p5-Dancer-Plugin-Preprocess-Markdown/issues. You will be notified automatically of any progress on your issue.
This is open source software. The code repository is available for public review and contribution under the terms of the license.
https://github.com/odyniec/p5-Dancer-Plugin-Preprocess-Markdown
git clone https://github.com/odyniec/p5-Dancer-Plugin-Preprocess-Markdown.git
Michal Wojciechowski <odyniec@cpan.org>
This software is copyright (c) 2013 by Michal Wojciechowski.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Dancer::Plugin::Preprocess::Markdown, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dancer::Plugin::Preprocess::Markdown
CPAN shell
perl -MCPAN -e shell install Dancer::Plugin::Preprocess::Markdown
For more information on module installation, please visit the detailed CPAN module installation guide.