App-md2html

 view release on metacpan or  search on metacpan

lib/App/md2html.pm  view on Meta::CPAN

use Encode qw(encode decode);
use Text::Markdown::Hoedown;
use HTML::Entities qw(encode_entities decode_entities);
use Const::Fast;
use Syntax::Keyword::Dynamically;
use IPC::Nosh::Common;

const our $CHARSET_DEFAULT => 'UTF-8';
const our %HTMLOPT_DEFAULT => (
    doctype => '<!DOCTYPE html>',
    head    => [ '<head>', qq!<meta charset="$CHARSET_DEFAULT">!, '</head>' ]
);

field $embedded : param : accessor //=
  first { $_ } @ENV{ ( map { "MD2HTML_$_" } qw'EMBEDDED FRAGMENT' ) };

field $doctype : param : accessor { $HTMLOPT_DEFAULT{doctype} };

field $htmlopt : param : accessor = { %HTMLOPT_DEFAULT, doctype => $doctype };

#ield $encodeopt :param : accessor = { in => $App:: out => $encoding_in}

script/md2html.pl  view on Meta::CPAN

method cli : common ( $argv = \@ARGV ) {
    my %cliopt = ( in => [], out => [] );

    GetOptionsFromArray(
        $argv,
        \%cliopt,

        'outfile=s{,}'
        ,    # If this is empty should we enable --embedded|no-header|fragment

        'encoding_in|charset|charset-in|encoding|inencoding=s',
        'encoding_out|outcharset|outencoding|outencode|charset-out=s',

        # 'css|stylesheeet:s',

        # 'toc:s',

        'htmldoc|full-html|html-page!',

        #'doctype:s',
        #'header:s',
        'embedded|fragment',



( run in 0.714 second using v1.01-cache-2.11-cpan-39bf76dae61 )