Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
use strict;
use CGI;
use Cwd;
use Text::MultiMarkdown 'markdown';
my $q = CGI->new();
my $file = File::Spec->catfile(cwd(), $q->path_info());
open my $fh, '<', $file or die "Failed to open $file: $!";
my $content = do { local $/; <$fh> };
print $q->header(
-content_type => 'text/html; charset=utf-8',
wrap_html( markdown($content) );
sub wrap_html {
my ($markdown) = @_;
my $output = <<EOM;
<style type="text/css">
body {
font-family: Halvetica, sans-serif;
padding-left: 2em;
pre { padding-left: 2em }
$output .= $markdown;
$output .= <<EOM;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.