« lib/Rapi/Blog/Template/Postprocessor/MarkdownElement.pm
↑ Summary
lib/Rapi/Blog/DB/Result/PreauthActionEvent.pm »
| 1 | package Rapi::Blog::Template::Postprocessor::TextMarkdown; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | |||
| 5 | use RapidApp::Util qw(:all); | ||
| 6 | use Text::Markdown 'markdown'; | ||
| 7 | |||
| 8 | # This post-processor converts markdown to html using the native perl | ||
| 9 | # Text::Markdown package. The benefit of this is that the conversion | ||
| 10 | # happens on the server-side, and doesn't rely on client-side javascript. | ||
| 11 | # However, it doesn't do nearly as good a job as marked.js, which is used | ||
| 12 | # by the default post-processor MarkdownElement. | ||
| 13 | |||
| 14 | sub process { | ||
| 15 | shift if ($_[0] eq __PACKAGE__); | ||
| 16 | my ($output_ref, $context) = @_; | ||
| 17 | |||
| 18 | return markdown($$output_ref); | ||
| 19 | } | ||
| 20 | |||
| 21 | |||
| 22 | 1; |