Ado

 view release on metacpan or  search on metacpan

lib/Ado/Plugin/MarkdownRenderer.pm  view on Meta::CPAN

        trac_url      => '/wiki',
        disable_links => [ qw( changeset ticket ) ],
      },
      md_method => 'parse',
      md_helper =>'trac_to_html'
    }},
    #...
  ],

  #2. Describe your routes
  routes     => [
        #markdown_renderer route is already configured
        #in etc/plugins/markdown_renderer.conf.

        #Your own great enterprise wiki
        {route => '/wiki/*md_file', via => ['GET'],
          to => 'wiki#show',},
        #...
        ],

  #3. Write your controller
  package Ado::Control::Wiki;
  use Mojo::Base 'Ado::Control';
  #...

=head1 DESCRIPTION

L<Ado::Plugin::MarkdownRenderer> is a markdown renderer (маани, маани!)

You only need to create a controller for your enterprise wiki and use
the L</md_to_html> helper provided by this plugin.
See L<Ado::Control::Doc> for an example.

You may use this plugin to load and use other markup languages parsers
and converters to HTML.

The code of this plugin is a good example for learning to build new plugins,
you're welcome to fork it.

=head1 OPTIONS

The following options can be set in C<etc/plugins/markdown_renderer.$mode.conf>
or C<etc/ado.conf>. You can find default options in
C<etc/plugins/markdown_renderer.conf>. C<md_> prefix is short for "markup
document" or "markdown".

=head2 md_renderer

  md_renderer => 'Text::MultiMarkdown',

The class to load. This option exists because the user may want to use
L<Text::Markdown> or L<Text::Markup> instead.

=head2  md_method

  md_method => 'markdown',

Method that will be used internally to produce the C<$HTML>.
Can also be a code reference.
First parameter is the md_renderer instance and the
second is the markdown text.

=head2 md_options

  md_options => {
      use_wikilinks => 1,
      base_url      => '/docs',
  },

These options will be passed to the md_renderer constructor.
They are specific for each markup parser so look at it's documentation.

=head2 md_helper

  md_helper => 'md_to_html',

Helper name. You may want to change this if you want to have
different helpers for different markup converters,
configurations, applications etc. in the same ado instance.
Default helper name is L</md_to_html>.

=head2 md_root

  md_root         => app->home->rel_dir('public/doc'),

Directory where the raw files reside.

=head2 md_articles_root

  md_articles_root         => app->home->rel_dir('public/articles'),

Directory used by L<Ado::Control::Articles> where the raw markdown files reside
and where the static HTML files are generated.


=head2 md_file_sufixes

  md_file_sufixes => ['.md'],

File-suffixes supported by your renderer.

=head2 md_reuse_produced_html

  md_reuse_produced_html => 1,

Do not convert files on every request but reuse already produced html files.


=head1 HELPERS

L<Ado::Plugin::MarkdownRenderer> exports the following helpers for use in
L<Ado::Control> methods and templates.

=head2 markdown

Accepts markdown text and options. Returns HTML.
Accepts the same parameters as L<Text::MulltiMarkdown/markdown>

  #in a controller
  $c->render(text=>$c->markdown($text));



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