Markdown.pl: correct .svg extension matching rule
[markdown.git] / README
blob2713c6464dadf724ca8b97c58be261f3f985353b
1 ========
2 Markdown
3 ========
5 Version 1.1.5
7 John Gruber  
8 Kyle J. McKay
11 ------------
12 Introduction
13 ------------
15 Markdown is a text-to-HTML conversion tool for web writers. Markdown
16 allows you to write using an easy-to-read, easy-to-write plain text
17 format, then convert it to structurally valid XHTML (or HTML).
19 Thus, "Markdown" is two things: a plain text markup syntax, and a
20 software tool, written in Perl, that converts the plain text markup
21 to HTML.
23 Markdown works both as a Movable Type plug-in and as a standalone Perl
24 script -- which means it can also be used as a text filter in BBEdit
25 (or any other application that supporst filters written in Perl).
27 Full documentation of Markdown's syntax and configuration options is
28 available in the `basics.md` and `syntax.md` files.
29 (Note: this readme file and the basics and syntax files are formatted
30 in Markdown.)
33 -----------------------------
34 Installation and Requirements
35 -----------------------------
37 Markdown requires Perl 5.8.0 or later. Welcome to the 21st Century.
38 Markdown also requires the standard Perl library module `Digest::MD5`.
40 As of version 1.1.1, Markdown auto-detects the character set of the
41 input (US-ASCII, ISO-8859-1 and UTF-8 are supported) and always
42 converts the input to UTF-8 when writing the output.
45 Movable Type
46 ~~~~~~~~~~~~
48 Markdown works with Movable Type version 2.6 or later (including
49 MT 3.0 or later).
51 1.  Copy the "Markdown.pl" file into your Movable Type "plugins"
52     directory. The "plugins" directory should be in the same directory
53     as "mt.cgi"; if the "plugins" directory doesn't already exist, use
54     your FTP program to create it. Your installation should look like
55     this:
57         (mt home)/plugins/Markdown.pl
59 2.  Once installed, Markdown will appear as an option in Movable Type's
60     Text Formatting pop-up menu. This is selectable on a per-post basis.
61     Markdown translates your posts to HTML when you publish; the posts
62     themselves are stored in your MT database in Markdown format.
64 3.  If you also install SmartyPants 1.5 (or later), Markdown will offer
65     a second text formatting option: "Markdown with SmartyPants". This
66     option is the same as the regular "Markdown" formatter, except that
67     automatically uses SmartyPants to create typographically correct
68     curly quotes, em-dashes, and ellipses. See the SmartyPants web page
69     for more information: <http://daringfireball.net/projects/smartypants/>
71 4.  To make Markdown (or "Markdown with SmartyPants") your default
72     text formatting option for new posts, go to Weblog Config ->
73     Preferences.
75 Note that by default, Markdown produces XHTML output. To configure
76 Markdown to produce HTML 4 output, see "Configuration", below.
79 Blosxom
80 ~~~~~~~
82 Markdown works with Blosxom version 2.x.
84 1.  Rename the "Markdown.pl" plug-in to "Markdown" (case is
85     important). Movable Type requires plug-ins to have a ".pl"
86     extension; Blosxom forbids it.
88 2.  Copy the "Markdown" plug-in file to your Blosxom plug-ins folder.
89     If you're not sure where your Blosxom plug-ins folder is, see the
90     Blosxom documentation for information.
92 3.  That's it. The entries in your weblog will now automatically be
93     processed by Markdown.
95 4.  If you'd like to apply Markdown formatting only to certain posts,
96     rather than all of them, see Jason Clark's instructions for using
97     Markdown in conjunction with Blosxom's Meta plugin:
99     <http://jclark.org/weblog/WebDev/Blosxom/Markdown.html>
102 BBEdit
103 ~~~~~~
105 Markdown works with BBEdit 6.1 or later on Mac OS X. (It also works
106 with BBEdit 5.1 or later and MacPerl 5.6.1 on Mac OS 8.6 or later.)
108 1.  Copy the "Markdown.pl" file to appropriate filters folder in your
109     "BBEdit Support" folder. On Mac OS X, this should be:
111         BBEdit Support/Unix Support/Unix Filters/
113     See the BBEdit documentation for more details on the location of
114     these folders.
116     You can rename "Markdown.pl" to whatever you wish.
118 2.  That's it. To use Markdown, select some text in a BBEdit document,
119     then choose Markdown from the Filters sub-menu in the "#!" menu, or
120     the Filters floating palette
123 -------------
124 Configuration
125 -------------
127 By default, Markdown produces XHTML output for tags with empty elements.
128 E.g.:
130       <br />
132 Markdown can be configured to produce HTML-style tags; e.g.:
134       <br>
137 Movable Type
138 ~~~~~~~~~~~~
140 You need to use a special `MTMarkdownOptions` container tag in each
141 Movable Type template where you want HTML 4-style output:
143     <MTMarkdownOptions output='html4'>
144         ... put your entry content here ...
145     </MTMarkdownOptions>
147 The easiest way to use MTMarkdownOptions is probably to put the
148 opening tag right after your `<body>` tag, and the closing tag right
149 before `</body>`.
151 To suppress Markdown processing in a particular template, i.e. to
152 publish the raw Markdown-formatted text without translation into
153 (X)HTML, set the `output` attribute to 'raw':
155     <MTMarkdownOptions output='raw'>
156         ... put your entry content here ...
157     </MTMarkdownOptions>
160 Command-Line
161 ~~~~~~~~~~~~
163 Use the `--html4tags` command-line switch to produce HTML output from a
164 Unix-style command line. E.g.:
166     % perl Markdown.pl --html4tags foo.txt
168 Type `perldoc Markdown.pl`, or read the POD documentation within the
169 Markdown.pl source code for more information.
172 ---------------
173 Version History
174 ---------------
176 1.1.5 (07 Dec 2017):
178 * Markdown.pl: support tables
180 * Markdown.pl: make sure all alt= and title= text is escaped
183 1.1.4 (24 Jun 2017):
185 + Markdown.pl: disallow <dir> and <menu> without --deprecated
188 1.1.3 (13 Feb 2017):
190 + Markdown.pl: auto escape '<' of non-tags
192 + Markdown.pl: do not overlook sibling list items
195 1.1.2 (19 Jan 2017):
197 + Markdown.pl: usually (i), (v) and (x) are roman
199 + Markdown.pl: retain square brackets around footnotes
201 + Markdown.pl: treat '*' in `<ol>` like last marker
203 + Markdown.pl: normalize link white space
205 + Markdown.pl: do not mishandle double list markers redux
207 + Markdown.pl: recognize two ```-delimited blocks in a row
209 + Markdown: allow trailing '[]' to be omitted
211 + Markdown.pl: tweak code block output again
214 1.1.1 (12 Jan 2017):
216 + Markdown.pl: support lower-greek ol lists
218 + Markdown.pl: auto-detect latin-1/utf-8 input always output utf-8  
219   The minimum version of Perl required is now 5.8.0.
222 1.1.0 (11 Jan 2017):
224 + Markdown.pl: handle some limited [[wiki style links]]
226 + Markdown.pl: add --stub, --stylesheet and --tabwidth options
228 + Markdown.pl: support more list markers
230 + Markdown.pl: format fancy checkboxes
232 + Markdown.pl: add anchors and definitions for headers
234 + Markdown.pl: do not mishandle double list markers
236 + Markdown.pl: handle non-backticks-delimited code blocks properly
238 + Markdown.pl: recognize top-level lists better
240 + Markdown.pl: output deterministic documents
242 + Markdown.pl: auto linkify without '<'...'>'
245 1.0.4 (05 Jun 2016):
247 + Markdown.pl can now be require'd and the Markdown function called
248   repeatedly by external code.
250 + Backticks (```) delimited code blocks are now handled better and are
251   no longer subject to any further accidental processing.
254 1.0.3 (06 Sep 2015):
256 + Added support for --htmlroot option to set a URL prefix.
258 + Relaxed matching rule for non-indented code blocks.
260 + Added support for --imageroot option to set an img URL prefix.
263 1.0.2 (03 Sep 2015):
265 + Added support for -h and --help to display Markdown.pl help.
267 + Added support for third-level headers using setext-like
268   underlining using tildes (`~`'s).
270 + Added support for an optional overline using the same character
271   as the underline when using setext-style headers.
273 + Stopped recognizing `_` within words.  The `*` character is still
274   recognized within words.
276 + Added support for strike through text using `~~` similarly to the
277   way strong works using `**`.
279 + Added support for non-indended code blocks by preceding and following
280   them with a line consisting of 3 backtick quotes (`` ` ``) or more.
283 1.0.1 (14 Dec 2004):
285 + Changed the syntax rules for code blocks and spans. Previously,
286   backslash escapes for special Markdown characters were processed
287   everywhere other than within inline HTML tags. Now, the contents
288   of code blocks and spans are no longer processed for backslash
289   escapes. This means that code blocks and spans are now treated
290   literally, with no special rules to worry about regarding
291   backslashes.
293   **NOTE**: This changes the syntax from all previous versions of
294   Markdown. Code blocks and spans involving backslash characters
295   will now generate different output than before.
297 + Tweaked the rules for link definitions so that they must occur
298   within three spaces of the left margin. Thus if you indent a link
299   definition by four spaces or a tab, it will now be a code block.
301            [a]: /url/  "Indented 3 spaces, this is a link def"
303             [b]: /url/  "Indented 4 spaces, this is a code block"
305   **IMPORTANT**: This may affect existing Markdown content if it
306   contains link definitions indented by 4 or more spaces.
308 + Added `>`, `+`, and `-` to the list of backslash-escapable
309   characters. These should have been done when these characters
310   were added as unordered list item markers.
312 + Trailing spaces and tabs following HTML comments and `<hr/>` tags
313   are now ignored.
315 + Inline links using `<` and `>` URL delimiters weren't working:
317           like [this](<http://example.com/>)
319 + Added a bit of tolerance for trailing spaces and tabs after
320   Markdown hr's.
322 + Fixed bug where auto-links were being processed within code spans:
324           like this: `<http://example.com/>`
326 + Sort-of fixed a bug where lines in the middle of hard-wrapped
327   paragraphs, which lines look like the start of a list item,
328   would accidentally trigger the creation of a list. E.g. a
329   paragraph that looked like this:
331           I recommend upgrading to version
332           8. Oops, now this line is treated
333           as a sub-list.
335   This is fixed for top-level lists, but it can still happen for
336   sub-lists. E.g., the following list item will not be parsed
337   properly:
339           + I recommend upgrading to version
340             8. Oops, now this line is treated
341             as a sub-list.
343   Given Markdown's list-creation rules, I'm not sure this can
344   be fixed.
346 + Standalone HTML comments are now handled; previously, they'd get
347   wrapped in a spurious `<p>` tag.
349 + Fix for horizontal rules preceded by 2 or 3 spaces.
351 + `<hr>` HTML tags in must occur within three spaces of left
352   margin. (With 4 spaces or a tab, they should be code blocks, but
353   weren't before this fix.)
355 + Capitalized "With" in "Markdown With SmartyPants" for
356   consistency with the same string label in SmartyPants.pl.
357   (This fix is specific to the MT plug-in interface.)
359 + Auto-linked email address can now optionally contain
360  a 'mailto:' protocol. I.e. these are equivalent:
362           <mailto:user@example.com>
363           <user@example.com>
365 + Fixed annoying bug where nested lists would wind up with
366   spurious (and invalid) `<p>` tags.
368 + You can now write empty links:
370           [like this]()
372   and they'll be turned into anchor tags with empty href attributes.
373   This should have worked before, but didn't.
375 + `***this***` and `___this___` are now turned into
377           <strong><em>this</em></strong>
379   Instead of
381           <strong><em>this</strong></em>
383   which isn't valid. (Thanks to Michel Fortin for the fix.)
385 + Added a new substitution in `_EncodeCode()`: `s/\$/&#036;/g`;
386   this is only for the benefit of Blosxom users, because Blosxom
387   (sometimes?) interpolates Perl scalars in your article bodies.
389 + Fixed problem for links defined with urls that include parens, e.g.:
391           [1]: http://sources.wikipedia.org/wiki/Middle_East_Policy_(Chomsky)
393   "Chomsky" was being erroneously treated as the URL's title.
395 + At some point during 1.0's beta cycle, I changed every sub's
396   argument fetching from this idiom:
398           my $text = shift;
400   to:
402           my $text = shift || return '';
404   The idea was to keep Markdown from doing any work in a sub
405   if the input was empty. This introduced a bug, though:
406   if the input to any function was the single-character string
407   "0", it would also evaluate as false and return immediately.
408   How silly. Now fixed.
411 ---------------------
412 Copyright and License
413 ---------------------
415 Copyright (C) 2003-2004 John Gruber  
416 Copyright (C) 2015-2017 Kyle J. McKay  
417 All rights reserved.
419 Redistribution and use in source and binary forms, with or without
420 modification, are permitted provided that the following conditions are
421 met:
423 * Redistributions of source code must retain the above copyright notice,
424   this list of conditions and the following disclaimer.
426 * Redistributions in binary form must reproduce the above copyright
427   notice, this list of conditions and the following disclaimer in the
428   documentation and/or other materials provided with the distribution.
430 * Neither the name "Markdown" nor the names of its contributors may
431   be used to endorse or promote products derived from this software
432   without specific prior written permission.
434 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
435 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
436 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
437 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
438 OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
439 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
440 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
441 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
442 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
443 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
444 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.