use Text::Upskirt qw/markdown smartypants/; my $markdown = << 'EOMD'; Installation ============ The simplest way to install this is with cpanm! Thanks to 'Natacha Porté' for Upskirt. EOMD my $html = markdown($markdown); my $fancyhtml = smartypants($html);
At this point $html contains the basic html rendered from the markdown, which will look like
<h1>Installation</h1> <p>The simplest way to install this is with cpanm! Thanks to 'Natacha Porté' and any other contributors for Upskirt</p>
and $fancyhtml has had smart quotes and things added to look like this
<h1>Installation</h1> <p>The simplest way to install this is with cpanm! Thanks to ‘Natacha Porté’ and any other contributors for Upskirt</p>
$html = markdown($input, $extensions, $html_options)
markdown takes it's input as a string and returns the rendered HTML output.
Both $extensions and $html_options are optional and default to nothing.
Automatically create links from urls and email addresses.
Allow for fenced code blocks using ~ and `. This lets you do code blocks without indention which can make copy-paste easier after the fact.
SYNOPSIS -------- ~~~~~~~ use Text::Upskirt qw/markdown smartypants/; my $markdown = << 'EOMD'; Installation ============ The simplest way to install this is with cpanm! Thanks to 'Natacha Porté' for Upskirt. EOMD my $html = markdown($markdown); my $fancyhtml = smartypants($html); ~~~~~~~
NOTES: If you plan on using
smartypants you may encounter issues if you attempt to use the ``fancy'' quote style exhibited there.
Allow HTML tags inside paragraphs without being surrounded by newlines.
Avoid turning text like
<em>awesome</em>function. You will need to escape phrases as
I like it when you say, "_I love you_."
Force a space between header hashes and the header itself
Let you make strikethroughs by surrounding text with ~~.
Let you create tables similar to the PHP Markdown Extra
First Header | Second Header ------------- | ------------- Content Cell | Content Cell Content Cell | Content Cell
Don't output any of the boilerplate HTML tags at the start of the document
Don't add any
<style> tags to the output
Don't process any image markdown and remove any
<img> tags from the output
Don't process any link markdown and remove any
<a> tags from the output
Does not appear to be used in the code.
Don’t make hyperlinks from links that have unknown URL types.
Build a table of contents on the top of the output
Treat newlines in paragraphs as real line breaks, github style.
Don't include any extra CSS for code blocks
Generate XHTML 1.0 compliant tags
$html = smartpants($input)
smartypants takes input as a string and returns the fancy HTML output. You can read a bit more about smartypants at http://daringfireball.net/projects/smartypants/.
Upskirt is a fast, robust Markdown parsing library that doesn't suck, Created by Natacha Porté. This module is a set of bindings for it. It is bundled along with the module and is seperately licensed as specified below.
Copyright (c) 2008, Natacha Porté Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
And while the sources are available with the module, you're probably going to have a nicer time grabbing them from the github repository for Upskirt at https://github.com/tanoku/upskirt
This module is available under the Artistic 2.0 license as available at http://www.perlfoundation.org/artistic_license_2_0 Copyright Ryan Voots 2011.