tag won't be wrapped with tag
=back
=head1 SEE ALSO
There are other modules on CPAN for converting Markdown:
=over 4
=item *
L is a pure-perl markdown converter.
=item *
L is a toolkit for parsing markdown,
which can also be used to convert markdown to HTML.
=item *
L is a converter than can handle a number of input formats, including markdown.
=item *
L converts MultiMarkdown (a superset of the original markdown format)
to HTML.
=back
Additional markdown resources:
=over 4
=item *
L -
David Loren Parsons's library for converting markdown, written in C.
=item *
L -
John Gruber's original definition of the markdown format.
=item *
L -
John Gruber's testsuite for markdown.
=item *
L - a review
of all Perl modules for handling markdown, written by Neil Bowers.
=back
=head1 AUTHOR
Masayoshi Sekimura, Esekimura@cpan.orgE
=head1 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.
This product includes software developed by
David Loren Parsons
=cut
Text-Markdown-Discount-0.16/xt/MarkdownTest_1.0.3.t 000644 000765 000024 00000002415 14205047226 023057 0 ustar 00msekimura staff 000000 000000 # Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl Text-Markdown-XS.t'
#########################
# change 'tests => 1' to 'tests => last_test_to_print';
use ExtUtils::testlib;
use Test::More qw(no_plan);
BEGIN { use_ok('Text::Markdown::Discount') };
#########################
use FindBin qw($Bin);
use Text::Diff;
opendir(DIR, "$Bin/../xt/MarkdownTest_1.0.3/Tests");
foreach my $testfile (grep { /\.text$/ } readdir(DIR)) {
my $testname = $testfile;
$testname =~ s{(.+)\.text$}{$1}i;
open (EXPECTED, "$Bin/../xt/MarkdownTest_1.0.3/Tests/$testname" . '.html') or die "NO html file for $testname";
my $expected = do {undef $/; };
my $actual = `$Bin/../xt/MarkdownXS.pl '$Bin/../xt/MarkdownTest_1.0.3/Tests/$testfile'` or die "failed run MarkdownXS.pl $testfile";
$expected =~ s{'}{'\\''}g; # escape ' chars for shell
$actual =~ s{'}{'\\''}g;
$expected = `echo '$expected' | tidy --show-body-only 1 --quiet 1 --show-warnings 0`;
$actual = `echo '$actual' | tidy --show-body-only 1 --quiet 1 --show-warnings 0`;
if ($actual eq $expected) {
pass($testname);
} else {
fail($testname);
diag diff \$expected, \$actual;
}
}
Text-Markdown-Discount-0.16/xt/test.pl 000644 000765 000024 00000001042 14205047226 021040 0 ustar 00msekimura staff 000000 000000 #/usr/bin/perl
use ExtUtils::testlib;
use Text::Markdown 'markdown';
use Text::Markdown::Discount;
use Benchmark;
use File::Slurp;
use Text::Diff;
my $text = read_file('xt/index.text');
my $a = Text::Markdown::Discount::markdown($text);
my $b = Text::Markdown::markdown($text);
unless ( $a eq $b ) {
print diff \$a, \$b;
#die "BOO";
}
my $count = 1000;
timethese($count, {
'B_Text::Markdown::Discount' => sub { Text::Markdown::Discount::markdown($text) },
'A_Text::Markdown' => sub { Text::Markdown::markdown($text) },
});
Text-Markdown-Discount-0.16/xt/index.text 000644 000765 000024 00000017777 14205047226 021567 0 ustar 00msekimura staff 000000 000000
Download
--------
[Markdown 1.0.1][dl] (18 KB) -- 17 Dec 2004
[dl]: http://daringfireball.net/projects/downloads/Markdown_1.0.1.zip
Introduction
------------
Markdown is a text-to-HTML conversion tool for web writers. Markdown
allows you to write using an easy-to-read, easy-to-write plain text
format, then convert it to structurally valid XHTML (or HTML).
Thus, "Markdown" is two things: (1) a plain text formatting syntax;
and (2) a software tool, written in Perl, that converts the plain text
formatting to HTML. See the [Syntax][] page for details pertaining to
Markdown's formatting syntax. You can try it out, right now, using the
online [Dingus][].
[syntax]: /projects/markdown/syntax
[dingus]: /projects/markdown/dingus
The overriding design goal for Markdown's formatting syntax is to make
it as readable as possible. The idea is that a Markdown-formatted
document should be publishable as-is, as plain text, without looking
like it's been marked up with tags or formatting instructions. While
Markdown's syntax has been influenced by several existing text-to-HTML
filters, the single biggest source of inspiration for Markdown's
syntax is the format of plain text email.
The best way to get a feel for Markdown's formatting syntax is simply
to look at a Markdown-formatted document. For example, you can view
the Markdown source for the article text on this page here:
(You can use this '.text' suffix trick to view the Markdown source for
the content of each of the pages in this section, e.g. the
[Syntax][s_src] and [License][l_src] pages.)
[s_src]: /projects/markdown/syntax.text
[l_src]: /projects/markdown/license.text
Markdown is free software, available under a BSD-style open source
license. See the [License] [pl] page for more information.
[pl]: /projects/markdown/license
Discussion List
---------------
I've set up a public [mailing list for discussion about Markdown] [ml].
Any topic related to Markdown -- both its formatting syntax and
its software -- is fair game for discussion. Anyone who is interested
is welcome to join.
It's my hope that the mailing list will lead to good ideas for future
improvements to Markdown.
[ml]: http://six.pairlist.net/mailman/listinfo/markdown-discuss
Installation and Requirements
-----------------------------
Markdown requires Perl 5.6.0 or later. Welcome to the 21st Century.
Markdown also requires the standard Perl library module [Digest::MD5]
[md5], which is probably already installed on your server.
[md5]: http://search.cpan.org/dist/Digest-MD5/MD5.pm
### Movable Type ###
Markdown works with Movable Type version 2.6 or later (including
Movable Type 3.0).
1. Copy the "Markdown.pl" file into your Movable Type "plugins"
directory. The "plugins" directory should be in the same directory
as "mt.cgi"; if the "plugins" directory doesn't already exist, use
your FTP program to create it. Your installation should look like
this:
(mt home)/plugins/Markdown.pl
2. Once installed, Markdown will appear as an option in Movable Type's
Text Formatting pop-up menu. This is selectable on a per-post basis:
![Screenshot of Movable Type 'Text Formatting' Menu][tfmenu]
Markdown translates your posts to HTML when you publish; the posts
themselves are stored in your MT database in Markdown format.
3. If you also install SmartyPants 1.5 (or later), Markdown will
offer a second text formatting option: "Markdown With
SmartyPants". This option is the same as the regular "Markdown"
formatter, except that it automatically uses SmartyPants to create
typographically correct curly quotes, em-dashes, and ellipses. See
the [SmartyPants web page][sp] for more information.
4. To make Markdown (or "Markdown With SmartyPants") your default
text formatting option for new posts, go to Weblog Config:
Preferences.
Note that by default, Markdown produces XHTML output. To configure
Markdown to produce HTML 4 output, see "Configuration", below.
[sp]: http://daringfireball.net/projects/smartypants/
### Blosxom ###
Markdown works with Blosxom version 2.0 or later.
1. Rename the "Markdown.pl" plug-in to "Markdown" (case is
important). Movable Type requires plug-ins to have a ".pl"
extension; Blosxom forbids it.
2. Copy the "Markdown" plug-in file to your Blosxom plug-ins folder.
If you're not sure where your Blosxom plug-ins folder is, see the
Blosxom documentation for information.
3. That's it. The entries in your weblog will now automatically be
processed by Markdown.
4. If you'd like to apply Markdown formatting only to certain
posts, rather than all of them, Markdown can optionally be used in
conjunction with Blosxom's [Meta][] plug-in. First, install the
Meta plug-in. Next, open the Markdown plug-in file in a text
editor, and set the configuration variable `$g_blosxom_use_meta`
to 1. Then, simply include a "`meta-markup: Markdown`" header line
at the top of each post you compose using Markdown.
[meta]: http://www.blosxom.com/plugins/meta/meta.htm
### BBEdit ###
Markdown works with BBEdit 6.1 or later on Mac OS X. It also works
with BBEdit 5.1 or later and MacPerl 5.6.1 on Mac OS 8.6 or later. If
you're running Mac OS X 10.2 (Jaguar), you may need to install the
Perl module [Digest::MD5] [md5] from CPAN; Digest::MD5 comes
pre-installed on Mac OS X 10.3 (Panther).
1. Copy the "Markdown.pl" file to appropriate filters folder in your
"BBEdit Support" folder. On Mac OS X, this should be:
BBEdit Support/Unix Support/Unix Filters/
See the BBEdit documentation for more details on the location of
these folders.
You can rename "Markdown.pl" to whatever you wish.
2. That's it. To use Markdown, select some text in a BBEdit document,
then choose Markdown from the Filters sub-menu in the "#!" menu, or
the Filters floating palette
Configuration
-------------
By default, Markdown produces XHTML output for tags with empty elements.
E.g.:
Markdown can be configured to produce HTML-style tags; e.g.:
### Movable Type ###
You need to use a special `MTMarkdownOptions` container tag in each
Movable Type template where you want HTML 4-style output:
... put your entry content here ...
The easiest way to use MTMarkdownOptions is probably to put the
opening tag right after your `` tag, and the closing tag right
before ``.
To suppress Markdown processing in a particular template, i.e. to
publish the raw Markdown-formatted text without translation into
(X)HTML, set the `output` attribute to 'raw':
... put your entry content here ...
### Command-Line ###
Use the `--html4tags` command-line switch to produce HTML output from a
Unix-style command line. E.g.:
% perl Markdown.pl --html4tags foo.text
Type `perldoc Markdown.pl`, or read the POD documentation within the
Markdown.pl source code for more information.
Acknowledgements
----------------
[Aaron Swartz][] deserves a tremendous amount of credit for helping to
design Markdown's formatting syntax. Markdown is *much* better thanks
to Aaron's ideas, feedback, and testing. Also, Aaron's [html2text][]
is a very handy (and free) utility for turning HTML into
Markdown-formatted plain text.
[Nathaniel Irons][], [Dan Benjamin][], [Daniel Bogan][], and [Jason Perkins][]
also deserve thanks for their feedback.
[Michel Fortin][] has ported Markdown to PHP; it's a splendid port, and highly recommended for anyone looking for a PHP implementation of Markdown.
[Aaron Swartz]: http://www.aaronsw.com/
[Nathaniel Irons]: http://bumppo.net/
[Dan Benjamin]: http://hivelogic.com/
[Daniel Bogan]: http://waferbaby.com/
[Jason Perkins]: http://pressedpants.com/
[Michel Fortin]: http://www.michelf.com/projects/php-markdown/
[html2text]: http://www.aaronsw.com/2002/html2text/
[tfmenu]: /graphics/markdown/mt_textformat_menu.png
Text-Markdown-Discount-0.16/xt/MarkdownTest_1.0.3/ 000755 000765 000024 00000000000 14334527143 022674 5 ustar 00msekimura staff 000000 000000 Text-Markdown-Discount-0.16/xt/MarkdownXS.pl 000755 000765 000024 00000006460 14205047226 022132 0 ustar 00msekimura staff 000000 000000 #!/usr/bin/env perl
use strict;
use warnings;
use ExtUtils::testlib;
use Text::Markdown::Discount qw(markdown);
=head1 NAME
Markdown.pl - Convert Markdown syntax to (X)HTML
=head1 DESCRIPTION
This program is distributed as part of Perl's Text::Markdown module,
illustrating sample usage.
Markdown can be invoked on any file containing Markdown-syntax, and
will produce the corresponding (X)HTML on STDOUT:
$ cat file.txt
This is a *test*.
Absolutely _nothing_ to see here. _Just a **test**_!
* test
* Yup, test.
$ Markdown.pl file.txt
This is a test.
Absolutely nothing to see here. Just a test!
If no file is specified, it will expect its input from STDIN:
$ echo "A **simple** test" | markdown
A simple test
=head1 OPTIONS
=over
=item version
Shows the full information for this version
=item shortversion
Shows only the version number
=item html4tags
Produce HTML 4-style tags instead of XHTML - XHTML requires elements
that do not wrap a block (i.e. the C
tag) to state they will not
be closed, by closing with C>. HTML 4-style will plainly output
the tag as it comes:
$ echo '---' | markdown
$ echo '---' | markdown --html4tags
=item help
Shows this documentation
=back
=head1 AUTHOR
Copyright 2004 John Gruber
Copyright 2008 Tomas Doran
The manpage was written by Gunnar Wolf for its use
in Debian systems, but can be freely used elsewhere.
For full licensing information, please refer to
L's full documentation.
=head1 SEE ALSO
L, L
=cut
#### Check for command-line switches: #################
my %cli_opts;
use Getopt::Long;
Getopt::Long::Configure('pass_through');
GetOptions(\%cli_opts,
'version',
'shortversion',
'html4tags',
'help',
);
if ($cli_opts{'version'}) { # Version info
print "\nThis is Markdown, version $Text::Markdown::VERSION.\n";
print "Copyright 2004 John Gruber\n";
print "Copyright 2008 Tomas Doran\n";
print "Parts contributed by several other people.";
print "http://daringfireball.net/projects/markdown/\n\n";
exit 0;
}
if ($cli_opts{'shortversion'}) { # Just the version number string.
print $Text::Markdown::VERSION;
exit 0;
}
if ($cli_opts{'help'}) {
for my $dir (split m/:/, $ENV{PATH}) {
my $cmd = "$dir/perldoc";
exec($cmd, $0) if (-f $cmd and -x $cmd);
}
die "perldoc could not be found in your path - Cannot show help, sorry\n";
}
my $m;
if ($cli_opts{'html4tags'}) { # Use HTML tag style instead of XHTML
$m = Text::Markdown::Discount->new(empty_element_suffix => '>');
}
else {
$m = Text::Markdown::Discount->new;
}
sub main {
my (@fns) = @_;
my $f;
if (scalar @fns) {
foreach my $fn (@fns) {
die("Cannot find file $fn") unless (-r $fn);
my $fh;
open($fh, '<', $fn) or die;
$f = join('', <$fh>);
close($fh) or die;
}
}
else { # STDIN
local $/; # Slurp the whole file
$f = <>;
}
return $m->markdown($f);
}
print main(@ARGV) unless caller();
Text-Markdown-Discount-0.16/xt/MarkdownTest_1.0.3/Tests/ 000755 000765 000024 00000000000 14334527143 023776 5 ustar 00msekimura staff 000000 000000 Text-Markdown-Discount-0.16/xt/MarkdownTest_1.0.3/MarkdownTest.pl 000755 000765 000024 00000006523 14205047226 025660 0 ustar 00msekimura staff 000000 000000 #!/usr/bin/perl
#
# MarkdownTester -- Run tests for Markdown implementations
#
# Copyright (c) 2004 John Gruber
#
#
use strict;
use warnings;
use Getopt::Long;
use Benchmark;
use Text::Diff;
our $VERSION = '1.0';
# Mon 13 Dec 2004
my $time_start = new Benchmark;
my $test_dir = "Tests";
my $script = "./Markdown.pl";
my $use_tidy = 0;
my ($flag_version);
GetOptions (
"script=s" => \$script,
"testdir=s" => \$test_dir,
"tidy" => \$use_tidy,
"version" => \$flag_version,
);
if($flag_version) {
my $progname = $0;
$progname =~ s{.*/}{};
die "$progname version $VERSION\n";
}
unless (-d $test_dir) { die "'$test_dir' is not a directory.\n"; }
unless (-f $script) { die "$script does not exist.\n"; }
unless (-x $script) { die "$script is not executable.\n"; }
my $tests_passed = 0;
my $tests_failed = 0;
foreach my $testfile (glob "$test_dir/*.text") {
my $testname = $testfile;
$testname =~ s{.*/(.+)\.text$}{$1}i;
print "$testname ... ";
# Look for a corresponding .html file for each .text file:
my $resultfile = $testfile;
$resultfile =~ s{\.text$}{\.html}i;
unless (-f $resultfile) {die "'$resultfile' does not exist.\n";}
# open(TEST, $testfile) || die("Can't open testfile: $!");
open(RESULT, $resultfile) || die("Can't open resultfile: $!");
undef $/;
# my $t_input = ;
my $t_result = ;
my $t_output = `$script '$testfile'`;
# Normalize the output and expected result strings:
$t_result =~ s/\s+\z//; # trim trailing whitespace
$t_output =~ s/\s+\z//; # trim trailing whitespace
if ($use_tidy) {
# Escape the strings, pass them through to CLI tidy tool for tag-level equivalency
$t_result =~ s{'}{'\\''}g; # escape ' chars for shell
$t_output =~ s{'}{'\\''}g;
$t_result = `echo '$t_result' | tidy --show-body-only 1 --quiet 1 --show-warnings 0`;
$t_output = `echo '$t_output' | tidy --show-body-only 1 --quiet 1 --show-warnings 0`;
}
if ($t_output eq $t_result) {
print "OK\n";
$tests_passed++;
}
else {
print "FAILED\n\n";
print diff \$t_output, \$t_result;
$tests_failed++;
}
}
print "\n\n";
print "$tests_passed passed; $tests_failed failed.\n";
my $time_end = new Benchmark;
my $time_diff = timediff($time_end, $time_start);
print "Benchmark: ", timestr($time_diff), "\n";
__END__
=pod
=head1 NAME
B
=head1 SYNOPSIS
B [ B<--options> ] [ I ... ]
=head1 DESCRIPTION
=head1 OPTIONS
Use "--" to end switch parsing. For example, to open a file named "-z", use:
MarkdownTest.pl -- -z
=over 4
=item B<--script>
Specify the path to the Markdown script to test. Defaults to
"./Markdown.pl". Example:
./MarkdownTest.pl --script ./PHP-Markdown/php-markdown
=item B<--testdir>
Specify the path to a directory containing test data. Defaults to "Tests".
=item B<--tidy>
Flag to turn on using the command line 'tidy' tool to normalize HTML
output before comparing script output to the expected test result.
Assumes that the 'tidy' command is available in your PATH. Defaults to
off.
=back
=head1 BUGS
=head1 VERSION HISTORY
1.0 Mon 13 Dec 2004
=head1 COPYRIGHT AND LICENSE
Copyright (c) 2004 John Gruber
All rights reserved.
This is free software; you may redistribute it and/or modify it under
the same terms as Perl itself.
=cut
Text-Markdown-Discount-0.16/xt/MarkdownTest_1.0.3/Tests/Markdown_Documentation_-_Basics.text 000644 000765 000024 00000017600 14205047226 033057 0 ustar 00msekimura staff 000000 000000 Markdown: Basics
================
Getting the Gist of Markdown's Formatting Syntax
------------------------------------------------
This page offers a brief overview of what it's like to use Markdown.
The [syntax page] [s] provides complete, detailed documentation for
every feature, but Markdown should be very easy to pick up simply by
looking at a few examples of it in action. The examples on this page
are written in a before/after style, showing example syntax and the
HTML output produced by Markdown.
It's also helpful to simply try Markdown out; the [Dingus] [d] is a
web application that allows you type your own Markdown-formatted text
and translate it to XHTML.
**Note:** This document is itself written using Markdown; you
can [see the source for it by adding '.text' to the URL] [src].
[s]: /projects/markdown/syntax "Markdown Syntax"
[d]: /projects/markdown/dingus "Markdown Dingus"
[src]: /projects/markdown/basics.text
## Paragraphs, Headers, Blockquotes ##
A paragraph is simply one or more consecutive lines of text, separated
by one or more blank lines. (A blank line is any line that looks like a
blank line -- a line containing nothing spaces or tabs is considered
blank.) Normal paragraphs should not be intended with spaces or tabs.
Markdown offers two styles of headers: *Setext* and *atx*.
Setext-style headers for `` and `` are created by
"underlining" with equal signs (`=`) and hyphens (`-`), respectively.
To create an atx-style header, you put 1-6 hash marks (`#`) at the
beginning of the line -- the number of hashes equals the resulting
HTML header level.
Blockquotes are indicated using email-style '`>`' angle brackets.
Markdown:
A First Level Header
====================
A Second Level Header
---------------------
Now is the time for all good men to come to
the aid of their country. This is just a
regular paragraph.
The quick brown fox jumped over the lazy
dog's back.
### Header 3
> This is a blockquote.
>
> This is the second paragraph in the blockquote.
>
> ## This is an H2 in a blockquote
Output:
A First Level Header
A Second Level Header
Now is the time for all good men to come to
the aid of their country. This is just a
regular paragraph.
The quick brown fox jumped over the lazy
dog's back.
Header 3
This is a blockquote.
This is the second paragraph in the blockquote.
This is an H2 in a blockquote
### Phrase Emphasis ###
Markdown uses asterisks and underscores to indicate spans of emphasis.
Markdown:
Some of these words *are emphasized*.
Some of these words _are emphasized also_.
Use two asterisks for **strong emphasis**.
Or, if you prefer, __use two underscores instead__.
Output:
Some of these words are emphasized.
Some of these words are emphasized also.
Use two asterisks for strong emphasis.
Or, if you prefer, use two underscores instead.
## Lists ##
Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`,
`+`, and `-`) as list markers. These three markers are
interchangable; this:
* Candy.
* Gum.
* Booze.
this:
+ Candy.
+ Gum.
+ Booze.
and this:
- Candy.
- Gum.
- Booze.
all produce the same output:
Ordered (numbered) lists use regular numbers, followed by periods, as
list markers:
1. Red
2. Green
3. Blue
Output:
- Red
- Green
- Blue
If you put blank lines between items, you'll get `` tags for the
list item text. You can create multi-paragraph list items by indenting
the paragraphs by 4 spaces or 1 tab:
* A list item.
With multiple paragraphs.
* Another item in the list.
Output:
### Links ###
Markdown supports two styles for creating links: *inline* and
*reference*. With both styles, you use square brackets to delimit the
text you want to turn into a link.
Inline-style links use parentheses immediately after the link text.
For example:
This is an [example link](http://example.com/).
Output:
This is an
example link.
Optionally, you may include a title attribute in the parentheses:
This is an [example link](http://example.com/ "With a Title").
Output:
This is an
example link.
Reference-style links allow you to refer to your links by names, which
you define elsewhere in your document:
I get 10 times more traffic from [Google][1] than from
[Yahoo][2] or [MSN][3].
[1]: http://google.com/ "Google"
[2]: http://search.yahoo.com/ "Yahoo Search"
[3]: http://search.msn.com/ "MSN Search"
Output:
I get 10 times more traffic from Google than from Yahoo or MSN.
The title attribute is optional. Link names may contain letters,
numbers and spaces, but are *not* case sensitive:
I start my morning with a cup of coffee and
[The New York Times][NY Times].
[ny times]: http://www.nytimes.com/
Output:
I start my morning with a cup of coffee and
The New York Times.
### Images ###
Image syntax is very much like link syntax.
Inline (titles are optional):

Reference-style:
![alt text][id]
[id]: /path/to/img.jpg "Title"
Both of the above examples produce the same output:
### Code ###
In a regular paragraph, you can create code span by wrapping text in
backtick quotes. Any ampersands (`&`) and angle brackets (`<` or
`>`) will automatically be translated into HTML entities. This makes
it easy to use Markdown to write about HTML example code:
I strongly recommend against using any `