Text::Markdown::PerlExtensions - markdown converter that supports perl-specific extensions
In your markdown:
Have a look at M<PerlX::Define> in D<Moops> by A<TOBYINK>.
And to convert that:
use Text::Markdown::PerlExtensions qw(markdown); $html = markdown($markdown);
Text::Markdown::PerlExtensions provides a function for converting markdown to HTML. It is a subclass of Text::Markdown that provides three additional features:
Three pod-style formatting codes, used for distribution names, module names and PAUSE author IDs. These generate links to the relevant pages on MetaCPAN.
A mechanism for adding further pod-style formatting codes.
I wrote this module to use with my blogging engine. I found that I was constantly writing links to MetaCPAN, and wanted a terser notation. To refer to a module on CPAN, you use the M formatting code. If you write:
M<Module::Path>
This generates:
<a href="https://metacpan.org/pod/Module::Path" class="module">Module::Path</a>
The link is given a class, so you can style module names.
To refer to a distribution, use the D formatting code. If you write
D<Dancer>
this generates:
<a href="https://metacpan.org/release/Dancer" class="distribution">Dancer</a>
Similarly, to refer to a CPAN author, use the A formatting code. If you write:
A<NEILB>
<a href="https://metacpan.org/author/NEILB" class="cpanAuthor">NEILB</a>
All other syntax is as supported by Text::Markdown
You can add your own pod-style formatting codes. For each code you define a function that takes one text argument and returns the transformed version of that text.
The following shows how you could define I and B formatting codes, for italic and bold respectively:
use Text::Markdown::PerlExtensions qw(markdown add_formatting_code); sub format_italic { my $text = shift; return "<I>$text</I>"; } sub format_bold { my $text = shift; return "<B>$text</B>"; } add_formatting_code('I' => \&format_bold); add_formatting_code('B' => \&format_bold); my $md = 'Highlight with B<bold> and I<italic>.'; my $text = markdown($md);
Text::Markdown - the base class for this module.
Markdown - the original spec for markdown syntax.
https://github.com/neilbowers/Text-Markdown-PerlExtensions
Neil Bowers <neilb@cpan.org>
This software is copyright (c) 2014 by Neil Bowers <neilb@cpan.org>.
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 Text::Markdown::PerlExtensions, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::Markdown::PerlExtensions
CPAN shell
perl -MCPAN -e shell install Text::Markdown::PerlExtensions
For more information on module installation, please visit the detailed CPAN module installation guide.