Text::...scount(3pm)
π Text::...scount β like, the manual page, but make it make sense π
okay bestie, gather round, because this one is genuinely iconic. it's Text::Markdown::Discount, from the User Contributed Perl Documentation corner of the universe, and it is fast.
β¨ NAME β¨
Text::Markdown::Discount β a fast function for converting markdown to HTML (and yeah, it requires a C compiler, no cap π₯)
πΈ SYNOPSIS πΈ
use Text::Markdown::Discount;
my $html = markdown($text)
that's it. that's the whole vibe. π
π¦ DESCRIPTION π¦
So Text::Markdown::Discount is a perl interface to the "Discount" library, which is a C implementation of John Gruber's "markdown". C! as in, compiled! as in, fast! ποΈβ¨
It is the fastest of the Perl modules available for converting markdown β go look at the list in SEE ALSO if you don't believe me. And it passes Gruber's Markdown testsuite, which is the academic validation of the markdown world. π
Given that the performance of Discount is what it is, Text::Markdown::Discount processes markdown formatted text quickly and passes the Markdown test suite at <http://daringfireball.net/projects/downloads/MarkdownTest_1.0.zip>. Look at her go. π
β οΈ Important bestie warning: the interface of themarkdown()function in this module is not compatible with themarkdown()function inText::Markdown. Like, they are not the same girl. Do not assume. π
π EXPORT π
markdown is exported by default. she just shows up. she's already in the group chat. π
π FUNCTION π
Text::Markdown::Discount::with_html5_tags()
This function enables html5 block-level elements support. π
Once you call it, Text::Markdown::Discount::markdown() will handle these html5 tags as block elements:
asidefooterheaderhgroupnavsectionarticle
π NOTE: There is no way to disable/re-enable this feature in one process right now. So like... it's a one-way door. Choose wisely. πͺβ¨
Here's the little demo, verbatim:
use Text::Markdown::Discount;
Text::Markdown::Discount::with_html5_tags();
my $html = markdown('<article>content</article>');
#
# In $html, <article> tag won't be wrapped with <p> tag
see how the <article> tag won't be wrapped with a <p> tag? she's free. she's living her truth. π¦
π SEE ALSO π
There are other modules on CPAN for converting Markdown, if you're into that:
- Text::Markdown is a pure-perl markdown converter. (pure perl! no C compiler required! slower but unbothered. π )
- Markdent is a toolkit for parsing markdown, which can also be used to convert markdown to HTML.
- Text::Markup is a converter than can handle a number of input formats, including markdown.
- Text::MultiMarkdown converts MultiMarkdown (a superset of the original markdown format) to HTML.
Additional markdown resources, for the girlies who want lore:
- Discount <http://www.pell.portland.or.us/~orc/Code/markdown/> β David Loren Parsons's library for converting markdown, written in C.
- Markdown definition <http://daringfireball.net/projects/markdown/> β John Gruber's original definition of the markdown format.
- Markdown testsuite <http://daringfireball.net/projects/downloads/MarkdownTest_1.0.zip> β John Gruber's testsuite for markdown.
- Markdown modules <http://neilb.org/reviews/markdown.html> β a review of all Perl modules for handling markdown, written by Neil Bowers.
π AUTHOR π
Masayoshi Sekimura, <sekimura@cpan.org>
π«Ά COPYRIGHT AND LICENSE π«Ά
Copyright (C) 2013 by Masayoshi Sekimura
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available. π (free software!! we love to see it!!)
This product includes software developed by David Loren Parsons <http://www.pell.portland.or.us/~orc>
and that's the whole page, bestie. this was perl v5.40.0, dated 2025-02-02 β thanks for reading, mwah, go convert some markdown, ily ππ§π
π¦ where this page comes from
- debian trixie: libtext-markdown-discount-perl 0.18-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtext-markdown-discount-perl 0.18-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms