1Text::Markdown(3)     User Contributed Perl Documentation    Text::Markdown(3)
2
3
4

NAME

6       Text::Markdown - Convert Markdown syntax to (X)HTML
7

SYNOPSIS

9           use Text::Markdown 'markdown';
10           my $html = markdown($text);
11
12           use Text::Markdown 'markdown';
13           my $html = markdown( $text, {
14               empty_element_suffix => '>',
15               tab_width => 2,
16           } );
17
18           use Text::Markdown;
19           my $m = Text::Markdown->new;
20           my $html = $m->markdown($text);
21
22           use Text::Markdown;
23           my $m = Text::MultiMarkdown->new(
24               empty_element_suffix => '>',
25               tab_width => 2,
26           );
27           my $html = $m->markdown( $text );
28

DESCRIPTION

30       Markdown is a text-to-HTML filter; it translates an easy-to-read /
31       easy-to-write structured text format into HTML. Markdown's text format
32       is most similar to that of plain text email, and supports features such
33       as headers, *emphasis*, code blocks, blockquotes, and links.
34
35       Markdown's syntax is designed not as a generic markup language, but
36       specifically to serve as a front-end to (X)HTML. You can use span-level
37       HTML tags anywhere in a Markdown document, and you can use block level
38       HTML tags (like <div> and <table> as well).
39

SYNTAX

41       This module implements the 'original' Markdown markdown syntax from:
42
43           http://daringfireball.net/projects/markdown/
44
45       Note that Text::Markdown ensures that the output always ends with one
46       newline. The fact that multiple newlines are collapsed into one makes
47       sense, because this is the behavior of HTML towards whispace. The fact
48       that there's always a newline at the end makes sense again, given that
49       the output will always be nested in a block-level element (as opposed
50       to an inline element). That block element can be a "<p>" (most often),
51       or a "<table>".
52
53       Markdown is not interpreted in HTML block-level elements, in order for
54       chunks of pasted HTML (e.g. JavaScript widgets, web counters) to not be
55       magically (mis)interpreted. For selective processing of Markdown in
56       some, but not other, HTML block elements, add a "markdown" attribute to
57       the block element and set its value to 1, "on" or "yes":
58
59           <div markdown="1" class="navbar">
60           * Home
61           * About
62           * Contact
63           <div>
64
65       The extra "markdown" attribute will be stripped when generating the
66       output.
67

OPTIONS

69       Text::Markdown supports a number of options to its processor which
70       control the behaviour of the output document.
71
72       These options can be supplied to the constructor, or in a hash within
73       individual calls to the "markdown" method. See the SYNOPSIS for
74       examples of both styles.
75
76       The options for the processor are:
77
78       empty_element_suffix
79           This option controls the end of empty element tags:
80
81               '/>' for XHTML (default)
82               '>' for HTML
83
84       tab_width
85           Controls indent width in the generated markup. Defaults to 4.
86
87       trust_list_start_value
88           If true, ordered lists will use the first number as the starting
89           point for numbering.  This will let you pick up where you left off
90           by writing:
91
92             1. foo
93             2. bar
94
95             some paragraph
96
97             3. baz
98             6. quux
99
100           (Note that in the above, quux will be numbered 4.)
101

METHODS

103   new
104       A simple constructor, see the SYNTAX and OPTIONS sections for more
105       information.
106
107   markdown
108       The main function as far as the outside world is concerned. See the
109       SYNOPSIS for details on use.
110
111   urls
112       Returns a reference to a hash with the key being the markdown reference
113       and the value being the URL.
114
115       Useful for building scripts which preprocess a list of links before the
116       main content. See t/05options.t for an example of this hashref being
117       passed back into the markdown method to create links.
118

OTHER IMPLEMENTATIONS

120       Markdown has been re-implemented in a number of languages, and with a
121       number of additions.
122
123       Those that I have found are listed below:
124
125       C - <http://www.pell.portland.or.us/~orc/Code/discount>
126           Discount - Original Markdown, but in C. Fastest implementation
127           available, and passes MDTest.  Adds its own set of custom features.
128
129       python - <http://www.freewisdom.org/projects/python-markdown/>
130           Python Markdown which is mostly compatible with the original, with
131           an interesting extension API.
132
133       ruby (maruku) - <http://maruku.rubyforge.org/>
134           One of the nicest implementations out there. Builds a parse tree
135           internally so very flexible.
136
137       php - <http://michelf.com/projects/php-markdown/>
138           A direct port of Markdown.pl, also has a separately maintained
139           'extra' version, which adds a number of features that were borrowed
140           by MultiMarkdown.
141
142       lua - <http://www.frykholm.se/files/markdown.lua>
143           Port to lua. Simple and lightweight (as lua is).
144
145       haskell - <http://johnmacfarlane.net/pandoc/>
146           Pandoc is a more general library, supporting Markdown,
147           reStructuredText, LaTeX and more.
148
149       javascript - <http://www.attacklab.net/showdown-gui.html>
150           Direct(ish) port of Markdown.pl to JavaScript
151

BUGS

153       To file bug reports or feature requests please send email to:
154
155           bug-Text-Markdown@rt.cpan.org
156
157       Please include with your report: (1) the example input; (2) the output
158       you expected; (3) the output Markdown actually produced.
159

VERSION HISTORY

161       See the Changes file for detailed release notes for this version.
162

AUTHOR

164           John Gruber
165           http://daringfireball.net/
166
167           PHP port and other contributions by Michel Fortin
168           http://michelf.com/
169
170           MultiMarkdown changes by Fletcher Penney
171           http://fletcher.freeshell.org/
172
173           CPAN Module Text::MultiMarkdown (based on Text::Markdown by Sebastian
174           Riedel) originally by Darren Kulp (http://kulp.ch/)
175
176           Support for markdown="1" by Dan Dascalescu (http://dandascalescu.com)
177
178           This module is maintained by: Tomas Doran http://www.bobtfish.net/
179

THIS DISTRIBUTION

181       Please note that this distribution is a fork of John Gruber's original
182       Markdown project, and it *is not* in any way blessed by him.
183
184       Whilst this code aims to be compatible with the original Markdown.pl
185       (and incorporates and passes the Markdown test suite) whilst fixing a
186       number of bugs in the original - there may be differences between the
187       behaviour of this module and Markdown.pl. If you find any differences
188       where you believe Text::Markdown behaves contrary to the Markdown spec,
189       please report them as bugs.
190
191       Text::Markdown *does not* extend the markdown dialect in any way from
192       that which is documented at daringfireball. If you want additional
193       features, you should look at Text::MultiMarkdown.
194

SOURCE CODE

196       You can find the source code repository for Text::Markdown and
197       Text::MultiMarkdown on GitHub at
198       <http://github.com/bobtfish/text-markdown>.
199
201       Original Code Copyright (c) 2003-2004 John Gruber
202       <http://daringfireball.net/> All rights reserved.
203
204       MultiMarkdown changes Copyright (c) 2005-2006 Fletcher T. Penney
205       <http://fletcher.freeshell.org/> All rights reserved.
206
207       Text::MultiMarkdown changes Copyright (c) 2006-2009 Darren Kulp
208       <http://kulp.ch> and Tomas Doran <http://www.bobtfish.net>
209
210       Redistribution and use in source and binary forms, with or without
211       modification, are permitted provided that the following conditions are
212       met:
213
214       * Redistributions of source code must retain the above copyright
215       notice,
216         this list of conditions and the following disclaimer.
217
218       * Redistributions in binary form must reproduce the above copyright
219         notice, this list of conditions and the following disclaimer in the
220         documentation and/or other materials provided with the distribution.
221
222       * Neither the name "Markdown" nor the names of its contributors may
223         be used to endorse or promote products derived from this software
224         without specific prior written permission.
225
226       This software is provided by the copyright holders and contributors "as
227       is" and any express or implied warranties, including, but not limited
228       to, the implied warranties of merchantability and fitness for a
229       particular purpose are disclaimed. In no event shall the copyright
230       owner or contributors be liable for any direct, indirect, incidental,
231       special, exemplary, or consequential damages (including, but not
232       limited to, procurement of substitute goods or services; loss of use,
233       data, or profits; or business interruption) however caused and on any
234       theory of liability, whether in contract, strict liability, or tort
235       (including negligence or otherwise) arising in any way out of the use
236       of this software, even if advised of the possibility of such damage.
237
238
239
240perl v5.32.0                      2020-07-28                 Text::Markdown(3)
Impressum