maruku 0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. data/bin/maruku +25 -0
  2. data/bin/marutex +29 -0
  3. data/docs/Makefile +25 -0
  4. data/docs/char_codes.xml +884 -0
  5. data/docs/color-package-demo.aux +1 -0
  6. data/docs/color-package-demo.log +127 -0
  7. data/docs/color-package-demo.tex +149 -0
  8. data/docs/index.html +74 -0
  9. data/docs/markdown_syntax.aux +13 -0
  10. data/docs/markdown_syntax.html +266 -0
  11. data/docs/markdown_syntax.log +287 -0
  12. data/docs/markdown_syntax.md +920 -0
  13. data/docs/markdown_syntax.out +0 -0
  14. data/docs/markdown_syntax.pdf +0 -0
  15. data/docs/markdown_syntax.tex +1203 -0
  16. data/docs/maruku.aux +13 -0
  17. data/docs/maruku.html +74 -0
  18. data/docs/maruku.log +294 -0
  19. data/docs/maruku.md +394 -0
  20. data/docs/maruku.out +0 -0
  21. data/docs/maruku.pdf +0 -0
  22. data/docs/maruku.tex +548 -0
  23. data/docs/style.css +65 -0
  24. data/docs/todo.md +12 -0
  25. data/lib/maruku.rb +20 -0
  26. data/lib/maruku/parse_block.rb +577 -0
  27. data/lib/maruku/parse_span.rb +336 -0
  28. data/lib/maruku/string_utils.rb +270 -0
  29. data/lib/maruku/structures.rb +31 -0
  30. data/lib/maruku/to_html.rb +430 -0
  31. data/lib/maruku/to_latex.rb +345 -0
  32. data/lib/maruku/to_latex_strings.rb +330 -0
  33. data/tests/abbreviations.md +11 -0
  34. data/tests/blank.md +4 -0
  35. data/tests/code.md +5 -0
  36. data/tests/code2.md +8 -0
  37. data/tests/code3.md +16 -0
  38. data/tests/email.md +4 -0
  39. data/tests/entities.md +19 -0
  40. data/tests/escaping.md +14 -0
  41. data/tests/extra_dl.md +101 -0
  42. data/tests/extra_header_id.md +13 -0
  43. data/tests/extra_table1.md +40 -0
  44. data/tests/footnotes.md +17 -0
  45. data/tests/headers.md +10 -0
  46. data/tests/hrule.md +10 -0
  47. data/tests/images.md +20 -0
  48. data/tests/inline_html.md +35 -0
  49. data/tests/links.md +31 -0
  50. data/tests/list1.md +4 -0
  51. data/tests/list2.md +5 -0
  52. data/tests/list3.md +8 -0
  53. data/tests/lists.md +32 -0
  54. data/tests/lists_ol.md +39 -0
  55. data/tests/misc_sw.md +105 -0
  56. data/tests/one.md +1 -0
  57. data/tests/paragraphs.md +13 -0
  58. data/tests/sss06.md +352 -0
  59. data/tests/test.md +4 -0
  60. metadata +113 -0
@@ -0,0 +1 @@
1
+ \relax
@@ -0,0 +1,127 @@
1
+ This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4) (format=pdflatex 2005.12.27) 25 DEC 2006 13:12
2
+ entering extended mode
3
+ **color-package-demo.tex
4
+ (./color-package-demo.tex
5
+ LaTeX2e <2003/12/01>
6
+ Babel <v3.8d> and hyphenation patterns for american, french, german, ngerman, b
7
+ ahasa, basque, bulgarian, catalan, croatian, czech, danish, dutch, esperanto, e
8
+ stonian, finnish, greek, icelandic, irish, italian, latin, magyar, norsk, polis
9
+ h, portuges, romanian, russian, serbian, slovak, slovene, spanish, swedish, tur
10
+ kish, ukrainian, nohyphenation, loaded.
11
+ (/sw/share/texmf-dist/tex/latex/base/article.cls
12
+ Document Class: article 2004/02/16 v1.4f Standard LaTeX document class
13
+ (/sw/share/texmf-dist/tex/latex/base/size11.clo
14
+ File: size11.clo 2004/02/16 v1.4f Standard LaTeX file (size option)
15
+ )
16
+ \c@part=\count79
17
+ \c@section=\count80
18
+ \c@subsection=\count81
19
+ \c@subsubsection=\count82
20
+ \c@paragraph=\count83
21
+ \c@subparagraph=\count84
22
+ \c@figure=\count85
23
+ \c@table=\count86
24
+ \abovecaptionskip=\skip41
25
+ \belowcaptionskip=\skip42
26
+ \bibindent=\dimen102
27
+ )
28
+ (/sw/share/texmf-dist/tex/latex/graphics/color.sty
29
+ Package: color 1999/02/16 v1.0i Standard LaTeX Color (DPC)
30
+
31
+ (/sw/share/texmf-dist/tex/latex/graphics/color.cfg
32
+ File: color.cfg 2005/02/03 v1.3 color configuration of teTeX/TeXLive
33
+ )
34
+ Package color Info: Driver file: pdftex.def on input line 125.
35
+
36
+ (/sw/share/texmf-dist/tex/latex/graphics/pdftex.def
37
+ File: pdftex.def 2002/06/19 v0.03k graphics/color for pdftex
38
+ \Gread@gobject=\count87
39
+ )
40
+ (/sw/share/texmf-dist/tex/latex/graphics/dvipsnam.def
41
+ File: dvipsnam.def 1999/02/16 v3.0i Driver-dependant file (DPC,SPQR)
42
+ ))
43
+ (./color-package-demo.aux)
44
+ \openout1 = `color-package-demo.aux'.
45
+
46
+ LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 16.
47
+ LaTeX Font Info: ... okay on input line 16.
48
+ LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 16.
49
+ LaTeX Font Info: ... okay on input line 16.
50
+ LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 16.
51
+ LaTeX Font Info: ... okay on input line 16.
52
+ LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 16.
53
+ LaTeX Font Info: ... okay on input line 16.
54
+ LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 16.
55
+ LaTeX Font Info: ... okay on input line 16.
56
+ LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 16.
57
+ LaTeX Font Info: ... okay on input line 16.
58
+ (/sw/share/texmf-dist/tex/context/base/supp-pdf.tex
59
+ (/sw/share/texmf-dist/tex/context/base/supp-mis.tex
60
+ loading : Context Support Macros / Miscellaneous (2004.10.26)
61
+ \protectiondepth=\count88
62
+ \scratchcounter=\count89
63
+ \scratchtoks=\toks14
64
+ \scratchdimen=\dimen103
65
+ \scratchskip=\skip43
66
+ \scratchmuskip=\muskip10
67
+ \scratchbox=\box26
68
+ \scratchread=\read1
69
+ \scratchwrite=\write3
70
+ \zeropoint=\dimen104
71
+ \onepoint=\dimen105
72
+ \onebasepoint=\dimen106
73
+ \minusone=\count90
74
+ \thousandpoint=\dimen107
75
+ \onerealpoint=\dimen108
76
+ \emptytoks=\toks15
77
+ \nextbox=\box27
78
+ \nextdepth=\dimen109
79
+ \everyline=\toks16
80
+ \!!counta=\count91
81
+ \!!countb=\count92
82
+ \recursecounter=\count93
83
+ )
84
+ loading : Context Support Macros / PDF (2004.03.26)
85
+ \nofMPsegments=\count94
86
+ \nofMParguments=\count95
87
+ \MPscratchCnt=\count96
88
+ \MPscratchDim=\dimen110
89
+ \MPnumerator=\count97
90
+ \everyMPtoPDFconversion=\toks17
91
+ )
92
+ LaTeX Font Info: External font `cmex10' loaded for size
93
+ (Font) <12> on input line 17.
94
+ LaTeX Font Info: External font `cmex10' loaded for size
95
+ (Font) <8> on input line 17.
96
+ LaTeX Font Info: External font `cmex10' loaded for size
97
+ (Font) <6> on input line 17.
98
+ LaTeX Font Info: External font `cmex10' loaded for size
99
+ (Font) <10.95> on input line 20.
100
+
101
+ Overfull \hbox (3.74078pt too wide) in paragraph at lines 53--57
102
+ \OT1/cmr/m/n/10.95 doc-u-ment. For ex-am-ple, []\OT1/cmtt/m/n/10.95 \textcolor{
103
+ MyDarkBlue}{a nice blue} \OT1/cmr/m/n/10.95 pro-duces
104
+ []
105
+
106
+ [1
107
+
108
+ {/Users/andrea/.texmf-var/fonts/map/pdftex/updmap/pdftex.map}] [2]
109
+ (./color-package-demo.aux) )
110
+ Here is how much of TeX's memory you used:
111
+ 960 strings out of 94500
112
+ 12417 string characters out of 1176113
113
+ 63475 words of memory out of 1000000
114
+ 4184 multiletter control sequences out of 10000+50000
115
+ 7759 words of font info for 28 fonts, out of 500000 for 2000
116
+ 580 hyphenation exceptions out of 1000
117
+ 21i,6n,19p,234b,185s stack positions out of 1500i,500n,5000p,200000b,5000s
118
+ PDF statistics:
119
+ 25 PDF objects out of 300000
120
+ 0 named destinations out of 131072
121
+ 1 words of extra memory for PDF output out of 65536
122
+ </sw/share/texmf-dist/fonts/type1/bluesky/cm/cmtt10
123
+ .pfb></sw/share/texmf-dist/fonts/type1/bluesky/cm/cmmi10.pfb></sw/share/texmf-d
124
+ ist/fonts/type1/bluesky/cm/cmr8.pfb></sw/share/texmf-dist/fonts/type1/bluesky/c
125
+ m/cmr10.pfb></sw/share/texmf-dist/fonts/type1/bluesky/cm/cmr12.pfb></sw/share/t
126
+ exmf-dist/fonts/type1/bluesky/cm/cmr17.pfb>
127
+ Output written on color-package-demo.pdf (2 pages, 49593 bytes).
@@ -0,0 +1,149 @@
1
+ %% color-package-demo.tex
2
+ %% Bent Petersen Oct 2000
3
+
4
+ \documentclass[11pt]{article}
5
+ \usepackage[usenames,dvipsnames]{color}
6
+
7
+ \title{\color{Blue}\jobname.tex}
8
+ \author{Bent Petersen}
9
+ \date{Oct 24, 2000}
10
+
11
+ \pagestyle{plain}
12
+
13
+ \setlength{\parindent}{0pt}
14
+ \setlength{\parskip}{2.0ex plus 0.6ex minus 0.4ex}
15
+
16
+ \begin{document}
17
+ \maketitle
18
+ \thispagestyle{empty}
19
+
20
+ The easiest way to use color text in \LaTeXe{} is to use the color
21
+ package. You load the color package in your preamble as usual
22
+ \begin{verbatim}
23
+ \documentclass[11pt]{article}
24
+ \usepackage[usenames]{color}
25
+ \end{verbatim}
26
+ Here the option [usenames] causes the definitions for the 68 colors
27
+ known to dvips (see next page) to be preloaded. Those colors can then
28
+ be specified by name. For example \verb={\color{BrickRed} BrickRed}=
29
+ produces {\color{BrickRed} BrickRed}. Alternately one can use the
30
+ command
31
+ \begin{verbatim}
32
+ \textcolor{BrickRed}{this is BrickRed}
33
+ \end{verbatim}
34
+ which produces \textcolor{BrickRed}{this is BrickRed}.
35
+
36
+ If the 68 predefined colors do not suffice, or if you do not want
37
+ to load the definitions of all of them, you may define your own
38
+ custom colors.
39
+
40
+ Here is a dark blue defined in terms of the RGB (red, green, blue) color model.
41
+ \begin{verbatim}
42
+ \definecolor{MyDarkBlue}{rgb}{0,0.08,0.45}
43
+ \begin{center}
44
+ {\color{MyDarkBlue}This color is MyDarkBlue}
45
+ \end{center}
46
+ \end{verbatim}
47
+ %%
48
+ \definecolor{MyDarkBlue}{rgb}{0.1,0,0.55}
49
+ \begin{center}
50
+ {\color{MyDarkBlue}This color is MyDarkBlue}
51
+ \end{center}
52
+ %%
53
+ Once we have defined the new color we can use it anywhere in
54
+ the current document. For example,
55
+ \verb=\textcolor{MyDarkBlue}{a nice blue}= produces
56
+ \textcolor{MyDarkBlue}{a nice blue}.
57
+
58
+ Custom colors may also be defined in terms of the CMYK
59
+ (cyan, magenta, yellow, black)
60
+ color model. Here is a light magenta.
61
+ %%
62
+ \begin{verbatim}
63
+ \definecolor{MyLightMagenta}{cmyk}{0.1,0.8,0,0.1}
64
+ \begin{center}
65
+ {\color{MyLightMagenta}This color is MyLightMagenta}
66
+ \end{center}
67
+ \end{verbatim}
68
+ %%
69
+ \definecolor{MyLightMagenta}{cmyk}{0.1,0.8,0,0.1}
70
+ \begin{center}
71
+ {\color{MyLightMagenta}This color is MyLightMagenta}
72
+ \end{center}
73
+
74
+ \begin{center}\large
75
+ The 68 standard colors known to dvips\vspace{0.5ex}
76
+ \begin{tabular}{|l|l|l|l|}
77
+ \hline
78
+ {\color{Apricot} Apricot}&
79
+ {\color{Aquamarine} Aquamarine}&
80
+ {\color{Bittersweet} Bittersweet}&
81
+ {\color{Black} Black}\\ \hline
82
+ {\color{Blue} Blue}&
83
+ {\color{BlueGreen} BlueGreen}&
84
+ {\color{BlueViolet} BlueViolet}&
85
+ {\color{BrickRed} BrickRed}\\ \hline
86
+ {\color{Brown} Brown}&
87
+ {\color{BurntOrange} BurntOrange}&
88
+ {\color{CadetBlue} CadetBlue}&
89
+ {\color{CarnationPink} CarnationPink}\\ \hline
90
+ {\color{Cerulean} Cerulean}&
91
+ {\color{CornflowerBlue} CornflowerBlue}&
92
+ {\color{Cyan} Cyan}&
93
+ {\color{Dandelion} Dandelion}\\ \hline
94
+ {\color{DarkOrchid} DarkOrchid}&
95
+ {\color{Emerald} Emerald}&
96
+ {\color{ForestGreen} ForestGreen}&
97
+ {\color{Fuchsia} Fuchsia}\\ \hline
98
+ {\color{Goldenrod} Goldenrod}&
99
+ {\color{Gray} Gray}&
100
+ {\color{Green} Green}&
101
+ {\color{GreenYellow} GreenYellow}\\ \hline
102
+ {\color{JungleGreen} JungleGreen}&
103
+ {\color{Lavender} Lavender}&
104
+ {\color{LimeGreen} LimeGreen}&
105
+ {\color{Magenta} Magenta}\\ \hline
106
+ {\color{Mahogany} Mahogany}&
107
+ {\color{Maroon} Maroon}&
108
+ {\color{Melon} Melon}&
109
+ {\color{MidnightBlue} MidnightBlue}\\ \hline
110
+ {\color{Mulberry} Mulberry}&
111
+ {\color{NavyBlue} NavyBlue}&
112
+ {\color{OliveGreen} OliveGreen}&
113
+ {\color{Orange} Orange}\\ \hline
114
+ {\color{OrangeRed} OrangeRed}&
115
+ {\color{Orchid} Orchid}&
116
+ {\color{Peach} Peach}&
117
+ {\color{Periwinkle} Periwinkle}\\ \hline
118
+ {\color{PineGreen} PineGreen}&
119
+ {\color{Plum} Plum}&
120
+ {\color{ProcessBlue} ProcessBlue}&
121
+ {\color{Purple} Purple}\\ \hline
122
+ {\color{RawSienna} RawSienna}&
123
+ {\color{Red} Red}&
124
+ {\color{RedOrange} RedOrange}&
125
+ {\color{RedViolet} RedViolet}\\ \hline
126
+ {\color{Rhodamine} Rhodamine}&
127
+ {\color{RoyalBlue} RoyalBlue}&
128
+ {\color{RoyalPurple} RoyalPurple}&
129
+ {\color{RubineRed} RubineRed}\\ \hline
130
+ {\color{Salmon} Salmon}&
131
+ {\color{SeaGreen} SeaGreen}&
132
+ {\color{Sepia} Sepia}&
133
+ {\color{SkyBlue} SkyBlue}\\ \hline
134
+ {\color{SpringGreen} SpringGreen}&
135
+ {\color{Tan} Tan}&
136
+ {\color{TealBlue} TealBlue}&
137
+ {\color{Thistle} Thistle}\\ \hline
138
+ {\color{Turquoise} Turquoise}&
139
+ {\color{Violet} Violet}&
140
+ {\color{VioletRed} VioletRed}&
141
+ {\color{White} White}\\ \hline
142
+ {\color{WildStrawberry} WildStrawberry}&
143
+ {\color{Yellow} Yellow}&
144
+ {\color{YellowGreen} YellowGreen}&
145
+ {\color{YellowOrange} YellowOrange}\\ \hline
146
+ \end{tabular}
147
+ \end{center}
148
+
149
+ \end{document}
@@ -0,0 +1,74 @@
1
+ <?xml version='1.0'?>
2
+ <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
3
+ 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
4
+ <html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'><head><title>Maruku, a Markdown interpreter</title><link href='style.css' rel='stylesheet' type='text/css' /></head><head><title>Maruku, a Markdown interpreter</title><link href='style.css' rel='stylesheet' type='text/css' /></head><body><h1>Mar<strong>u</strong>k<strong>u</strong>: a Markdown interpreter</h1><p>Maruku is a Markdown interpreter written in <a href='http://www.ruby-lang.org'>Ruby</a>.</p><p>Maruku allows you to write in an easy-to-read-and-write syntax, like this:</p><blockquote><p><a href='http://maruku.rubyforge.org/maruku.md'>This document in Markdown</a></p></blockquote><p>Then it can be translated to HTML:</p><blockquote><p><a href='http://maruku.rubyforge.org/maruku.html'>This document in HTML</a></p></blockquote><p>or Latex, which is then converted to PDF:</p><blockquote><p><a href='http://maruku.rubyforge.org/maruku.pdf'>This document in PDF</a></p></blockquote><p>Maruku implements the original <a href='http://daringfireball.net/projects/markdown/syntax'>Markdown syntax</a> (<a href='http://maruku.rubyforge.org/markdown_syntax.html'>HTML</a> or <a href='http://maruku.rubyforge.org/markdown_syntax.pdf'>PDF</a>, translated by Maruku).</p><p>Markdown implements also all the improvements in <a href='http://www.michelf.com/projects/php-markdown/extra/'>PHP Markdown Extra</a>.</p><p>Moreover, it implements ideas from <a href='http://fletcher.freeshell.org/wiki/MultiMarkdown'>MultiMarkdown</a>.</p><hr /><p><em>Table of contents</em>:</p><ul><li><p><a href='#download'>Download</a></p></li><li><p><a href='#usage'>Usage</a></p></li><li><p><a href='#extra'>Examples of PHP Markdown extra syntax</a></p></li><li><p><a href='#meta'>New metadata syntax</a></p></li><li><p><a href='#metalist'>List of metadata</a></p></li><li><p><a href='#maruku-and-bluecloth'>Maruku and Bluecloth</a></p></li><li><p><a href='#future'>Future developments</a></p><ul><li><a href='#future-export'>Export to other formats</a></li><li><a href='#future-syntax'>Syntax additions</a></li></ul></li></ul><hr /><h2 class='head' id='download'>Download</h2><p>The development site is <a href='http://maruku.rubyforge.net/'>http://maruku.rubyforge.net/</a>.</p><p>Download current <a href='http://rubygems.rubyforge.org/'>gem</a> at <a href='http://maruku.rubyforge.net/gem1.0'>http://maruku.rubyforge.net/gem1.0</a></p><h2>Usage</h2><p>This is the basic usage:</p><pre class='ruby' style='background-color: #f0f0e0;'><span class='ident'>require</span> <span class='punct'>'</span><span class='string'>maruku</span><span class='punct'>'</span>
5
+
6
+ <span class='ident'>doc</span> <span class='punct'>=</span> <span class='constant'>Maruku</span><span class='punct'>.</span><span class='ident'>new</span><span class='punct'>(</span><span class='ident'>markdown_string</span><span class='punct'>)</span>
7
+ <span class='ident'>puts</span> <span class='ident'>doc</span><span class='punct'>.</span><span class='ident'>to_html</span>
8
+ </pre><p>or, if you install through RubyGems,</p><pre class='ruby' style='background-color: #f0f0e0;'><span class='ident'>require</span> <span class='punct'>'</span><span class='string'>rubygems</span><span class='punct'>'</span>
9
+ <span class='ident'>require</span> <span class='punct'>'</span><span class='string'>maruku</span><span class='punct'>'</span>
10
+ </pre><p>This outputs a complete XHTML 1.0 document:</p><pre class='ruby' style='background-color: #f0f0e0;'><span class='ident'>puts</span> <span class='ident'>doc</span><span class='punct'>.</span><span class='ident'>to_html_document</span></pre><p>You can have the REXML document tree with:</p><pre class='ruby' style='background-color: #f0f0e0;'><span class='ident'>tree</span> <span class='punct'>=</span> <span class='ident'>doc</span><span class='punct'>.</span><span class='ident'>to_html_document_tree</span>
11
+ </pre><h3>From the command line</h3><p>There are two command-line programs installed: <tt style='background-color: #f0f0e0;'>maruku</tt> and <tt style='background-color: #f0f0e0;'>marutex</tt></p><p><tt style='background-color: #f0f0e0;'>maruku</tt> converts Markdown in HTML:</p><pre style='background-color: #f0f0e0;'>$ maruku file.md # creates file.html
12
+ </pre><p><tt style='background-color: #f0f0e0;'>marutex</tt> converts Markdown in TeX, then calls <tt style='background-color: #f0f0e0;'>pdflatex</tt> to transform to PDF:</p><pre style='background-color: #f0f0e0;'>$ marutex file.md # creates file.tex and file.pdf
13
+
14
+ </pre><h2 id='extra'>Examples of PHP Markdown Extra syntax</h2><ul><li><p>tables</p><pre style='background-color: #f0f0e0;'>Col1 | Very very long head | Very very long head|
15
+ -----|:-------------------:|-------------------:|
16
+ cell | center-align | right-align |
17
+ </pre><table class='example'><thead><tr><th>Col1</th><th>Very very long head</th><th>Very very long head</th></tr></thead><tbody><tr><td style='text-align: left;'>cell</td><td style='text-align: center;'>center-align</td><td style='text-align: right;'>right-align</td></tr></tbody></table></li><li><p>footnotes <sup id='fnref:1'><a href='#fn:1' rel='footnote'>1</a></sup></p><pre style='background-color: #f0f0e0;'>*footnotes [^foot]
18
+
19
+ [^foot]: I really was missing those.</pre></li><li><p>Markdown inside HTML elememnts</p></li></ul><pre class='xml' style='background-color: #f0f0e0;'><span class='punct'>&lt;</span><span class='tag'>div</span> <span class='attribute'>markdown</span><span class='punct'>=&quot;</span><span class='string'>1</span><span class='punct'>&quot;</span> <span class='attribute'>style</span><span class='punct'>=&quot;</span><span class='string'>border: solid 1px black</span><span class='punct'>&quot;&gt;</span>
20
+ This is a div with Markdown **strong text**
21
+ <span class='punct'>&lt;/</span><span class='tag'>div</span><span class='punct'>&gt;</span>
22
+ </pre><div style='border: solid 1px black'><p>This is a div with Markdown <strong>strong text</strong></p></div><ul><li><p>header ids</p><pre style='background-color: #f0f0e0;'>## Header ## {#id}</pre><p>For example, <a href='#download'>a link to the download</a> header.</p></li><li><p>definition lists</p><pre style='background-color: #f0f0e0;'>Definition list
23
+ : something very hard to parse
24
+ </pre><dl><dt>Definition list</dt><dd>something very hard to parse</dd></dl></li><li><p>abbreviations or <abbr title='Simple an abbreviation'>ABB</abbr> for short.</p></li></ul><h2 id='maruku-and-bluecloth'>Maruku and Bluecloth</h2><p>The other Ruby implementation of Markdown is <a href='http://www.deveiate.org/projects/BlueCloth'>Bluecloth</a>.</p><p>Maruku is much different in philosophy from Bluecloth: the biggest difference is that <em>parsing</em> is separated from <em>rendering</em>. In Maruku, an in-memory representation of the Markdown document is created. Instead, Bluecloth mantains the document in memory as a String at all times, and does a series of <tt style='background-color: #f0f0e0;'>gsub</tt> to transform to HTML.<sup id='fnref:2'><a href='#fn:2' rel='footnote'>2</a></sup></p><p>The in-memory representation makes it very easy to export to various formats (altough, for, now)</p><p>Other improvements over Bluecloth:</p><ul><li><p>the HTML output is provided also as a <tt style='background-color: #f0f0e0;'>REXML</tt> document tree.</p></li><li><p>PHP Markdown Syntax support.</p></li></ul><h2 id='meta'>New meta-data syntax</h2><p>Maruku implements a syntax that allows to attach &quot;meta&quot; information to objects.</p><h3>Meta-data for the document</h3><p>Meta-data for the document itself is specified through the use of email headers:</p><pre style='background-color: #f0f0e0;'>Title: A simple document containing meta-headers
25
+ CSS: style.css
26
+
27
+ Content of the document
28
+ </pre><p>When creating the document through</p><pre class='ruby' style='background-color: #f0f0e0;'><span class='constant'>Maruku</span><span class='punct'>.</span><span class='ident'>new</span><span class='punct'>(</span><span class='ident'>s</span><span class='punct'>).</span><span class='ident'>to_html_document</span>
29
+ </pre><p>the title and stylesheet are added as expected.</p><h3>Meta-data for elements</h3><p>Maruku introduces a new syntax for attaching metadata to paragraphs, tables, and so on.</p><p>For example, consider the creation of two paragraphs:</p><pre style='background-color: #f0f0e0;'>Paragraph 1 is a warning.
30
+
31
+ Paragraph 2
32
+ </pre><p>Now you really want to attach a &apos;class&apos; attribute to the paragraphs (for example for CSS styling). Maruku allows you to use:</p><pre style='background-color: #f0f0e0;'>@ class: warning
33
+ Paragraph 1 is a warning
34
+
35
+ Paragraph 2
36
+
37
+ </pre><p>You can add more by separating with a <tt style='background-color: #f0f0e0;'>;</tt>:</p><pre style='background-color: #f0f0e0;'>@ class: warning; id: warning1
38
+ Paragraph 1 is a warning
39
+ </pre><p>A meta-data declaration is composed of</p><ol><li>newline</li><li>an at-symbol &apos;@&apos;</li><li>a series of name-value pairs. Each name-value is separated by a colon <tt style='background-color: #f0f0e0;'>:</tt>, pairs are separated by semi-colons <tt style='background-color: #f0f0e0;'>;</tt></li></ol><p>Many declaration can be used, and they refer to <em>the following</em> object:</p><pre style='background-color: #f0f0e0;'>@ class: warning
40
+ @ id: warning1
41
+ Paragraph 1 is a warning
42
+ </pre><p>These can also be separated by newlines:</p><pre style='background-color: #f0f0e0;'>@ class: warning
43
+
44
+ @ id: warning1
45
+
46
+ Paragraph 1 is a warning
47
+ </pre><p>Also, if the value is not present, it defaults to <tt style='background-color: #f0f0e0;'>true</tt>:</p><pre style='background-color: #f0f0e0;'>@ test
48
+
49
+ This paragraph has the attribute &apos;test&apos; set.
50
+ </pre><hr /><h2 id='metalist'>List of meta-data</h2><dl><dt><strong><tt style='background-color: #f0f0e0;'>title</tt>, <tt style='background-color: #f0f0e0;'>subject</tt></strong></dt><dd><p>(document) Sets the title of the document use in <tt style='background-color: #f0f0e0;'>title</tt> element.</p></dd><dt><strong><tt style='background-color: #f0f0e0;'>css</tt></strong></dt><dd><p>(document, HTML) Url of stylesheet.</p></dd><dt><strong><tt style='background-color: #f0f0e0;'>latex_use_syntax</tt></strong></dt><dd><p>(document, HTML) Use the [<tt style='background-color: #f0f0e0;'>syntax</tt> library][syntax] to add source highlighting.</p></dd><dt><strong><tt style='background-color: #f0f0e0;'>latex_use_listings</tt></strong></dt><dd><p>(document, LaTex) Use fancy <tt style='background-color: #f0f0e0;'>listing</tt> package for better displaying code blocks.</p></dd><dt><strong><tt style='background-color: #f0f0e0;'>style</tt>, <tt style='background-color: #f0f0e0;'>id</tt>, <tt style='background-color: #f0f0e0;'>class</tt></strong></dt><dd><p>(any block object, HTML) Standard CSS attributes are copied.</p></dd><dt><strong><tt style='background-color: #f0f0e0;'>lang</tt></strong></dt><dd><p>(code blocks) Name of programming language (<tt style='background-color: #f0f0e0;'>ruby</tt>) for syntax highlighting (does not work yet)</p><p>Default for this is <tt style='background-color: #f0f0e0;'>code_lang</tt> in document.</p></dd><dt><strong><tt style='background-color: #f0f0e0;'>code_show_spaces</tt></strong></dt><dd><p>Shows tabs and newlines (default is read in the document object).</p></dd><dt><strong><tt style='background-color: #f0f0e0;'>code_background_color</tt></strong></dt><dd><p>Background color for code blocks. (default is read in the document object).</p><p>The format is either a named color (<tt style='background-color: #f0f0e0;'>green</tt>, <tt style='background-color: #f0f0e0;'>red</tt>) or a CSS color of the form <tt style='background-color: #f0f0e0;'>#ff00ff</tt>.</p><ul><li><p>for <strong>HTML output</strong>, the value is put straight in the <tt style='background-color: #f0f0e0;'>background-color</tt> CSS property of the block.</p></li><li><p>for <strong>LaTeX output</strong>, if it is a named color, it must be a color accepted by the latex <tt style='background-color: #f0f0e0;'>color</tt> packages. If it is of the form <tt style='background-color: #f0f0e0;'>#ff00ff</tt>, Maruku defines a color using the <tt style='background-color: #f0f0e0;'>\definecolor</tt> macro.</p><p>For example, for <tt style='background-color: #f0f0e0;'>#0000ff</tt>, the macro is called as:</p><pre class='tex' style='background-color: #f0f0e0;'>\definecolor{DummyName}{rgb}{0,0,1} </pre></li></ul></dd></dl><h3>Examples</h3><p>An example of this is the following:</p><pre style='background-color: #f0f0e0;'>@&not;code_show_spaces;&not;code_background_color:&not;green
51
+
52
+ &raquo;&nbsp;&nbsp;&nbsp;&not;One&not;space
53
+ &raquo;&nbsp;&nbsp;&nbsp;&not;&not;Two&not;spaces
54
+ &raquo;&nbsp;&nbsp;&nbsp;&raquo;&nbsp;&nbsp;&nbsp;&not;&raquo;&nbsp;&nbsp;&nbsp;Tab,&not;space,&not;tab
55
+ &raquo;&nbsp;&nbsp;&nbsp;&raquo;&nbsp;&nbsp;&nbsp;&raquo;&nbsp;&nbsp;&nbsp;&raquo;&nbsp;&nbsp;&nbsp;Tab,&not;tab,&not;tab&not;and&not;all&not;is&not;green!
56
+ </pre><p>That will produce:</p><pre style='background-color: green;'>&not;One&not;space
57
+ &not;&not;Two&not;spaces
58
+ &raquo;&nbsp;&nbsp;&nbsp;&not;&raquo;&nbsp;&nbsp;&nbsp;Tab,&not;space,&not;tab
59
+ &raquo;&nbsp;&nbsp;&nbsp;&raquo;&nbsp;&nbsp;&nbsp;&raquo;&nbsp;&nbsp;&nbsp;Tab,&not;tab,&not;tab&not;and&not;all&not;is&not;green!
60
+ </pre><p>Example with css-style color:</p><pre style='background-color: #f0f0e0;'>@ code_background_color: #455678
61
+
62
+ A strange color
63
+ </pre><p>produces:</p><pre style='background-color: #455678;'>A strange color
64
+ </pre><p>Or highlighting (does not work well yet):</p><pre style='background-color: #f0f0e0;'>@ lang: xml
65
+ &lt;div style=&quot;text-align:center&quot;&gt;Div&lt;/div&gt;
66
+ </pre><p>produces:</p><pre class='xml' style='background-color: #f0f0e0;'><span class='punct'>&lt;</span><span class='tag'>div</span> <span class='attribute'>style</span><span class='punct'>=&quot;</span><span class='string'>text-align:center</span><span class='punct'>&quot;&gt;</span>Div<span class='punct'>&lt;/</span><span class='tag'>div</span><span class='punct'>&gt;</span>
67
+ </pre><hr /><h2 id='future'>Future developments</h2><p>I think that <a href='http://sophos.berkeley.edu/macfarlane/pandoc/'>Pandoc</a> and <a href='http://fletcher.freeshell.org/wiki/MultiMarkdown'>MultiMarkdown</a> are very cool projects. However, they are written in Haskell and Perl, respectively. I would love to have an equivalent in Ruby.</p><h3 id='future-syntax'>Syntax improvements</h3><p>Things I&apos;m thinking about:</p><ul><li><p>a syntax for commenting parts of the document:</p><pre style='background-color: #f0f0e0;'>This is a paragraph
68
+ % This is a comment</pre></li><li><p>choose a syntax for adding math:</p><pre style='background-color: #f0f0e0;'>This is inline math: $\alpha$
69
+
70
+ This is an equation with label:
71
+
72
+ $ \alpha = \beta + \gamma $ (eq:1)
73
+
74
+ This is a reference to equation: please see (eq:1)</pre></li></ul><div class='footnotes'><hr /><ol><li id='fn:1'><p>I really was missing those.<a href='#fnref:1' rev='footnote'>&#8617;</a></p></li><li id='fn:2'><p>&quot;a different philosophy&quot; stands for &quot;ugly&quot; <tt style='background-color: #f0f0e0;'>:-)</tt><a href='#fnref:2' rev='footnote'>&#8617;</a></p></li></ol></div></body></html>
@@ -0,0 +1,13 @@
1
+ \relax
2
+ \ifx\hyper@anchor\@undefined
3
+ \global \let \oldcontentsline\contentsline
4
+ \gdef \contentsline#1#2#3#4{\oldcontentsline{#1}{#2}{#3}}
5
+ \global \let \oldnewlabel\newlabel
6
+ \gdef \newlabel#1#2{\newlabelxx{#1}#2}
7
+ \gdef \newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}}
8
+ \AtEndDocument{\let \contentsline\oldcontentsline
9
+ \let \newlabel\oldnewlabel}
10
+ \else
11
+ \global \let \hyper@last\relax
12
+ \fi
13
+
@@ -0,0 +1,266 @@
1
+ <?xml version='1.0'?>
2
+ <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
3
+ 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
4
+ <html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'><head><title></title><link href='style.css' rel='stylesheet' type='text/css' /></head><head><title></title><link href='style.css' rel='stylesheet' type='text/css' /></head><body><h1>Markdown: Syntax</h1><p><strong>Note:</strong></p><p>This copy is translated using <a href='http://maruku.rubyforge.org'>Maruku</a>.</p><p><a href='http://daringfireball.net/projects/markdown/syntax'>Here</a> you can find the original by <tt style='background-color: #f0f0e0;'>Markdown.pl</tt>.</p><ul class='toc'><li><p><a href='#overview'>Overview</a></p><ul><li><a href='#philosophy'>Philosophy</a></li><li><a href='#html'>Inline HTML</a></li><li><a href='#autoescape'>Automatic Escaping for Special Characters</a></li></ul></li><li><p><a href='#block'>Block Elements</a></p><ul><li><a href='#p'>Paragraphs and Line Breaks</a></li><li><a href='#header'>Headers</a></li><li><a href='#blockquote'>Blockquotes</a></li><li><a href='#list'>Lists</a></li><li><a href='#precode'>Code Blocks</a></li><li><a href='#hr'>Horizontal Rules</a></li></ul></li><li><p><a href='#span'>Span Elements</a></p><ul><li><a href='#link'>Links</a></li><li><a href='#em'>Emphasis</a></li><li><a href='#code'>Code</a></li><li><a href='#img'>Images</a></li></ul></li><li><p><a href='#misc'>Miscellaneous</a></p><ul><li><a href='#backslash'>Backslash Escapes</a></li><li><a href='#autolink'>Automatic Links</a></li></ul></li></ul><hr /><h2 id='overview'>Overview</h2><h3 id='philosophy'>Philosophy</h3><p>Markdown is intended to be as easy-to-read and easy-to-write as is feasible.</p><p>Readability, however, is emphasized above all else. A Markdown-formatted document should be publishable as-is, as plain text, without looking like it&apos;s been marked up with tags or formatting instructions. While Markdown&apos;s syntax has been influenced by several existing text-to-HTML filters -- including <a href='http://docutils.sourceforge.net/mirror/setext.html'>Setext</a>, <a href='http://www.aaronsw.com/2002/atx/'>atx</a>, <a href='http://textism.com/tools/textile/'>Textile</a>, <a href='http://docutils.sourceforge.net/rst.html'>reStructuredText</a>, <a href='http://www.triptico.com/software/grutatxt.html'>Grutatext</a>, and <a href='http://ettext.taint.org/doc/'>EtText</a> -- the single biggest source of inspiration for Markdown&apos;s syntax is the format of plain text email.</p><p>To this end, Markdown&apos;s syntax is comprised entirely of punctuation characters, which punctuation characters have been carefully chosen so as to look like what they mean. E.g., asterisks around a word actually look like *emphasis*. Markdown lists look like, well, lists. Even blockquotes look like quoted passages of text, assuming you&apos;ve ever used email.</p><h3 id='html'>Inline HTML</h3><p>Markdown&apos;s syntax is intended for one purpose: to be used as a format for <em>writing</em> for the web.</p><p>Markdown is not a replacement for HTML, or even close to it. Its syntax is very small, corresponding only to a very small subset of HTML tags. The idea is <em>not</em> to create a syntax that makes it easier to insert HTML tags. In my opinion, HTML tags are already easy to insert. The idea for Markdown is to make it easy to read, write, and edit prose. HTML is a <em>publishing</em> format; Markdown is a <em>writing</em> format. Thus, Markdown&apos;s formatting syntax only addresses issues that can be conveyed in plain text.</p><p>For any markup that is not covered by Markdown&apos;s syntax, you simply use HTML itself. There&apos;s no need to preface it or delimit it to indicate that you&apos;re switching from Markdown to HTML; you just use the tags.</p><p>The only restrictions are that block-level HTML elements -- e.g. <tt style='background-color: #f0f0e0;'>&lt;div&gt;</tt>, <tt style='background-color: #f0f0e0;'>&lt;table&gt;</tt>, <tt style='background-color: #f0f0e0;'>&lt;pre&gt;</tt>, <tt style='background-color: #f0f0e0;'>&lt;p&gt;</tt>, etc. -- must be separated from surrounding content by blank lines, and the start and end tags of the block should not be indented with tabs or spaces. Markdown is smart enough not to add extra (unwanted) <tt style='background-color: #f0f0e0;'>&lt;p&gt;</tt> tags around HTML block-level tags.</p><p>For example, to add an HTML table to a Markdown article:</p><pre class='xml' style='background-color: #f0f0e0;'>This is a regular paragraph.
5
+
6
+ <span class='punct'>&lt;</span><span class='tag'>table</span><span class='punct'>&gt;</span>
7
+ <span class='punct'>&lt;</span><span class='tag'>tr</span><span class='punct'>&gt;</span>
8
+ <span class='punct'>&lt;</span><span class='tag'>td</span><span class='punct'>&gt;</span>Foo<span class='punct'>&lt;/</span><span class='tag'>td</span><span class='punct'>&gt;</span>
9
+ <span class='punct'>&lt;/</span><span class='tag'>tr</span><span class='punct'>&gt;</span>
10
+ <span class='punct'>&lt;/</span><span class='tag'>table</span><span class='punct'>&gt;</span>
11
+
12
+ This is another regular paragraph.
13
+ </pre><p>Note that Markdown formatting syntax is not processed within block-level HTML tags. E.g., you can&apos;t use Markdown-style <tt style='background-color: #f0f0e0;'>*emphasis*</tt> inside an HTML block.</p><p>Span-level HTML tags -- e.g. <tt style='background-color: #f0f0e0;'>&lt;span&gt;</tt>, <tt style='background-color: #f0f0e0;'>&lt;cite&gt;</tt>, or <tt style='background-color: #f0f0e0;'>&lt;del&gt;</tt> -- can be used anywhere in a Markdown paragraph, list item, or header. If you want, you can even use HTML tags instead of Markdown formatting; e.g. if you&apos;d prefer to use HTML <tt style='background-color: #f0f0e0;'>&lt;a&gt;</tt> or <tt style='background-color: #f0f0e0;'>&lt;img&gt;</tt> tags instead of Markdown&apos;s link or image syntax, go right ahead.</p><p>Unlike block-level HTML tags, Markdown syntax <em>is</em> processed within span-level tags.</p><h3 id='autoescape'>Automatic Escaping for Special Characters</h3><p>In HTML, there are two characters that demand special treatment: <tt style='background-color: #f0f0e0;'>&lt;</tt> and <tt style='background-color: #f0f0e0;'>&amp;</tt>. Left angle brackets are used to start tags; ampersands are used to denote HTML entities. If you want to use them as literal characters, you must escape them as entities, e.g. <tt style='background-color: #f0f0e0;'>&amp;lt;</tt>, and <tt style='background-color: #f0f0e0;'>&amp;amp;</tt>.</p><p>Ampersands in particular are bedeviling for web writers. If you want to write about &apos;AT&amp;T&apos;, you need to write &apos;<tt style='background-color: #f0f0e0;'>AT&amp;amp;T</tt>&apos;. You even need to escape ampersands within URLs. Thus, if you want to link to:</p><pre style='background-color: #f0f0e0;'>http://images.google.com/images?num=30&amp;q=larry+bird
14
+ </pre><p>you need to encode the URL as:</p><pre style='background-color: #f0f0e0;'>http://images.google.com/images?num=30&amp;amp;q=larry+bird
15
+ </pre><p>in your anchor tag <tt style='background-color: #f0f0e0;'>href</tt> attribute. Needless to say, this is easy to forget, and is probably the single most common source of HTML validation errors in otherwise well-marked-up web sites.</p><p>Markdown allows you to use these characters naturally, taking care of all the necessary escaping for you. If you use an ampersand as part of an HTML entity, it remains unchanged; otherwise it will be translated into <tt style='background-color: #f0f0e0;'>&amp;amp;</tt>.</p><p>So, if you want to include a copyright symbol in your article, you can write:</p><pre class='xml' style='background-color: #f0f0e0;'><span class='entity'>&amp;copy;</span>
16
+ </pre><p>and Markdown will leave it alone. But if you write:</p><pre style='background-color: #f0f0e0;'>AT&amp;T
17
+ </pre><p>Markdown will translate it to:</p><pre class='xml' style='background-color: #f0f0e0;'>AT<span class='entity'>&amp;amp;T</span>
18
+ </pre><p>Similarly, because Markdown supports <a href='#html'>inline HTML</a>, if you use angle brackets as delimiters for HTML tags, Markdown will treat them as such. But if you write:</p><pre style='background-color: #f0f0e0;'>4 &lt; 5
19
+ </pre><p>Markdown will translate it to:</p><pre class='xml' style='background-color: #f0f0e0;'>4 <span class='entity'>&amp;lt;</span> 5
20
+ </pre><p>However, inside Markdown code spans and blocks, angle brackets and ampersands are <em>always</em> encoded automatically. This makes it easy to use Markdown to write about HTML code. (As opposed to raw HTML, which is a terrible format for writing about HTML syntax, because every single <tt style='background-color: #f0f0e0;'>&lt;</tt> and <tt style='background-color: #f0f0e0;'>&amp;</tt> in your example code needs to be escaped.)</p><hr /><h2 id='block'>Block Elements</h2><h3 id='p'>Paragraphs and Line Breaks</h3><p>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 but spaces or tabs is considered blank.) Normal paragraphs should not be intended with spaces or tabs.</p><p>The implication of the &quot;one or more consecutive lines of text&quot; rule is that Markdown supports &quot;hard-wrapped&quot; text paragraphs. This differs significantly from most other text-to-HTML formatters (including Movable Type&apos;s &quot;Convert Line Breaks&quot; option) which translate every line break character in a paragraph into a <tt style='background-color: #f0f0e0;'>&lt;br /&gt;</tt> tag.</p><p>When you <em>do</em> want to insert a <tt style='background-color: #f0f0e0;'>&lt;br /&gt;</tt> break tag using Markdown, you end a line with two or more spaces, then type return.</p><p>Yes, this takes a tad more effort to create a <tt style='background-color: #f0f0e0;'>&lt;br /&gt;</tt>, but a simplistic &quot;every line break is a <tt style='background-color: #f0f0e0;'>&lt;br /&gt;</tt>&quot; rule wouldn&apos;t work for Markdown. Markdown&apos;s email-style <a href='#blockquote'>blockquoting</a> and multi-paragraph <a href='#list'>list items</a> work best -- and look better -- when you format them with hard breaks.</p><h3 id='header'>Headers</h3><p>Markdown supports two styles of headers, <a href='http://docutils.sourceforge.net/mirror/setext.html'>Setext</a> and <a href='http://www.aaronsw.com/2002/atx/'>atx</a>.</p><p>Setext-style headers are &quot;underlined&quot; using equal signs (for first-level headers) and dashes (for second-level headers). For example:</p><pre style='background-color: #f0f0e0;'>This is an H1
21
+ =============
22
+
23
+ This is an H2
24
+ -------------
25
+ </pre><p>Any number of underlining <tt style='background-color: #f0f0e0;'>=</tt>&apos;s or <tt style='background-color: #f0f0e0;'>-</tt>&apos;s will work.</p><p>Atx-style headers use 1-6 hash characters at the start of the line, corresponding to header levels 1-6. For example:</p><pre style='background-color: #f0f0e0;'># This is an H1
26
+
27
+ ## This is an H2
28
+
29
+ ###### This is an H6
30
+ </pre><p>Optionally, you may &quot;close&quot; atx-style headers. This is purely cosmetic -- you can use this if you think it looks better. The closing hashes don&apos;t even need to match the number of hashes used to open the header. (The number of opening hashes determines the header level.) :</p><pre style='background-color: #f0f0e0;'># This is an H1 #
31
+
32
+ ## This is an H2 ##
33
+
34
+ ### This is an H3 ######
35
+
36
+ </pre><h3 id='blockquote'>Blockquotes</h3><p>Markdown uses email-style <tt style='background-color: #f0f0e0;'>&gt;</tt> characters for blockquoting. If you&apos;re familiar with quoting passages of text in an email message, then you know how to create a blockquote in Markdown. It looks best if you hard wrap the text and put a <tt style='background-color: #f0f0e0;'>&gt;</tt> before every line:</p><pre style='background-color: #f0f0e0;'>&gt; This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
37
+ &gt; consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
38
+ &gt; Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
39
+ &gt;
40
+ &gt; Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
41
+ &gt; id sem consectetuer libero luctus adipiscing.
42
+ </pre><p>Markdown allows you to be lazy and only put the <tt style='background-color: #f0f0e0;'>&gt;</tt> before the first line of a hard-wrapped paragraph:</p><pre style='background-color: #f0f0e0;'>&gt; This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
43
+ consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
44
+ Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
45
+
46
+ &gt; Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
47
+ id sem consectetuer libero luctus adipiscing.
48
+ </pre><p>Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by adding additional levels of <tt style='background-color: #f0f0e0;'>&gt;</tt>:</p><pre style='background-color: #f0f0e0;'>&gt; This is the first level of quoting.
49
+ &gt;
50
+ &gt; &gt; This is nested blockquote.
51
+ &gt;
52
+ &gt; Back to the first level.
53
+ </pre><p>Blockquotes can contain other Markdown elements, including headers, lists, and code blocks:</p><pre style='background-color: #f0f0e0;'>&gt; ## This is a header.
54
+ &gt;
55
+ &gt; 1. This is the first list item.
56
+ &gt; 2. This is the second list item.
57
+ &gt;
58
+ &gt; Here&apos;s some example code:
59
+ &gt;
60
+ &gt; return shell_exec(&quot;echo $input | $markdown_script&quot;);
61
+ </pre><p>Any decent text editor should make email-style quoting easy. For example, with BBEdit, you can make a selection and choose Increase Quote Level from the Text menu.</p><h3 id='list'>Lists</h3><p>Markdown supports ordered (numbered) and unordered (bulleted) lists.</p><p>Unordered lists use asterisks, pluses, and hyphens -- interchangably -- as list markers:</p><pre style='background-color: #f0f0e0;'>* Red
62
+ * Green
63
+ * Blue
64
+ </pre><p>is equivalent to:</p><pre style='background-color: #f0f0e0;'>+ Red
65
+ + Green
66
+ + Blue
67
+ </pre><p>and:</p><pre style='background-color: #f0f0e0;'>- Red
68
+ - Green
69
+ - Blue
70
+ </pre><p>Ordered lists use numbers followed by periods:</p><pre style='background-color: #f0f0e0;'>1. Bird
71
+ 2. McHale
72
+ 3. Parish
73
+ </pre><p>It&apos;s important to note that the actual numbers you use to mark the list have no effect on the HTML output Markdown produces. The HTML Markdown produces from the above list is:</p><pre class='xml' style='background-color: #f0f0e0;'><span class='punct'>&lt;</span><span class='tag'>ol</span><span class='punct'>&gt;</span>
74
+ <span class='punct'>&lt;</span><span class='tag'>li</span><span class='punct'>&gt;</span>Bird<span class='punct'>&lt;/</span><span class='tag'>li</span><span class='punct'>&gt;</span>
75
+ <span class='punct'>&lt;</span><span class='tag'>li</span><span class='punct'>&gt;</span>McHale<span class='punct'>&lt;/</span><span class='tag'>li</span><span class='punct'>&gt;</span>
76
+ <span class='punct'>&lt;</span><span class='tag'>li</span><span class='punct'>&gt;</span>Parish<span class='punct'>&lt;/</span><span class='tag'>li</span><span class='punct'>&gt;</span>
77
+ <span class='punct'>&lt;/</span><span class='tag'>ol</span><span class='punct'>&gt;</span>
78
+ </pre><p>If you instead wrote the list in Markdown like this:</p><pre style='background-color: #f0f0e0;'>1. Bird
79
+ 1. McHale
80
+ 1. Parish
81
+ </pre><p>or even:</p><pre style='background-color: #f0f0e0;'>3. Bird
82
+ 1. McHale
83
+ 8. Parish
84
+ </pre><p>you&apos;d get the exact same HTML output. The point is, if you want to, you can use ordinal numbers in your ordered Markdown lists, so that the numbers in your source match the numbers in your published HTML. But if you want to be lazy, you don&apos;t have to.</p><p>If you do use lazy list numbering, however, you should still start the list with the number 1. At some point in the future, Markdown may support starting ordered lists at an arbitrary number.</p><p>List markers typically start at the left margin, but may be indented by up to three spaces. List markers must be followed by one or more spaces or a tab.</p><p>To make lists look nice, you can wrap items with hanging indents:</p><pre style='background-color: #f0f0e0;'>* Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
85
+ Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
86
+ viverra nec, fringilla in, laoreet vitae, risus.
87
+ * Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
88
+ Suspendisse id sem consectetuer libero luctus adipiscing.
89
+ </pre><p>But if you want to be lazy, you don&apos;t have to:</p><pre style='background-color: #f0f0e0;'>* Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
90
+ Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
91
+ viverra nec, fringilla in, laoreet vitae, risus.
92
+ * Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
93
+ Suspendisse id sem consectetuer libero luctus adipiscing.
94
+ </pre><p>If list items are separated by blank lines, Markdown will wrap the items in <tt style='background-color: #f0f0e0;'>&lt;p&gt;</tt> tags in the HTML output. For example, this input:</p><pre style='background-color: #f0f0e0;'>* Bird
95
+ * Magic
96
+ </pre><p>will turn into:</p><pre class='xml' style='background-color: #f0f0e0;'><span class='punct'>&lt;</span><span class='tag'>ul</span><span class='punct'>&gt;</span>
97
+ <span class='punct'>&lt;</span><span class='tag'>li</span><span class='punct'>&gt;</span>Bird<span class='punct'>&lt;/</span><span class='tag'>li</span><span class='punct'>&gt;</span>
98
+ <span class='punct'>&lt;</span><span class='tag'>li</span><span class='punct'>&gt;</span>Magic<span class='punct'>&lt;/</span><span class='tag'>li</span><span class='punct'>&gt;</span>
99
+ <span class='punct'>&lt;/</span><span class='tag'>ul</span><span class='punct'>&gt;</span>
100
+ </pre><p>But this:</p><pre style='background-color: #f0f0e0;'>* Bird
101
+
102
+ * Magic
103
+ </pre><p>will turn into:</p><pre class='xml' style='background-color: #f0f0e0;'><span class='punct'>&lt;</span><span class='tag'>ul</span><span class='punct'>&gt;</span>
104
+ <span class='punct'>&lt;</span><span class='tag'>li</span><span class='punct'>&gt;&lt;</span><span class='tag'>p</span><span class='punct'>&gt;</span>Bird<span class='punct'>&lt;/</span><span class='tag'>p</span><span class='punct'>&gt;&lt;/</span><span class='tag'>li</span><span class='punct'>&gt;</span>
105
+ <span class='punct'>&lt;</span><span class='tag'>li</span><span class='punct'>&gt;&lt;</span><span class='tag'>p</span><span class='punct'>&gt;</span>Magic<span class='punct'>&lt;/</span><span class='tag'>p</span><span class='punct'>&gt;&lt;/</span><span class='tag'>li</span><span class='punct'>&gt;</span>
106
+ <span class='punct'>&lt;/</span><span class='tag'>ul</span><span class='punct'>&gt;</span>
107
+ </pre><p>List items may consist of multiple paragraphs. Each subsequent paragraph in a list item must be intended by either 4 spaces or one tab:</p><pre style='background-color: #f0f0e0;'>1. This is a list item with two paragraphs. Lorem ipsum dolor
108
+ sit amet, consectetuer adipiscing elit. Aliquam hendrerit
109
+ mi posuere lectus.
110
+
111
+ Vestibulum enim wisi, viverra nec, fringilla in, laoreet
112
+ vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
113
+ sit amet velit.
114
+
115
+ 2. Suspendisse id sem consectetuer libero luctus adipiscing.
116
+ </pre><p>It looks nice if you indent every line of the subsequent paragraphs, but here again, Markdown will allow you to be lazy:</p><pre style='background-color: #f0f0e0;'>* This is a list item with two paragraphs.
117
+
118
+ This is the second paragraph in the list item. You&apos;re
119
+ only required to indent the first line. Lorem ipsum dolor
120
+ sit amet, consectetuer adipiscing elit.
121
+
122
+ * Another item in the same list.
123
+ </pre><p>To put a blockquote within a list item, the blockquote&apos;s <tt style='background-color: #f0f0e0;'>&gt;</tt> delimiters need to be indented:</p><pre style='background-color: #f0f0e0;'>* A list item with a blockquote:
124
+
125
+ &gt; This is a blockquote
126
+ &gt; inside a list item.
127
+ </pre><p>To put a code block within a list item, the code block needs to be indented <em>twice</em> -- 8 spaces or two tabs:</p><pre style='background-color: #f0f0e0;'>* A list item with a code block:
128
+
129
+ &lt;code goes here&gt;
130
+
131
+ </pre><p>It&apos;s worth noting that it&apos;s possible to trigger an ordered list by accident, by writing something like this:</p><pre style='background-color: #f0f0e0;'>1986. What a great season.
132
+ </pre><p>In other words, a <em>number-period-space</em> sequence at the beginning of a line. To avoid this, you can backslash-escape the period:</p><pre style='background-color: #f0f0e0;'>1986\\. What a great season.
133
+
134
+
135
+ </pre><h3 id='precode'>Code Blocks</h3><p>Pre-formatted code blocks are used for writing about programming or markup source code. Rather than forming normal paragraphs, the lines of a code block are interpreted literally. Markdown wraps a code block in both <tt style='background-color: #f0f0e0;'>&lt;pre&gt;</tt> and <tt style='background-color: #f0f0e0;'>&lt;code&gt;</tt> tags.</p><p>To produce a code block in Markdown, simply indent every line of the block by at least 4 spaces or 1 tab. For example, given this input:</p><pre style='background-color: #f0f0e0;'>This is a normal paragraph:
136
+
137
+ This is a code block.
138
+ </pre><p>Markdown will generate:</p><pre class='xml' style='background-color: #f0f0e0;'><span class='punct'>&lt;</span><span class='tag'>p</span><span class='punct'>&gt;</span>This is a normal paragraph:<span class='punct'>&lt;/</span><span class='tag'>p</span><span class='punct'>&gt;</span>
139
+
140
+ <span class='punct'>&lt;</span><span class='tag'>pre</span><span class='punct'>&gt;&lt;</span><span class='tag'>code</span><span class='punct'>&gt;</span>This is a code block.
141
+ <span class='punct'>&lt;/</span><span class='tag'>code</span><span class='punct'>&gt;&lt;/</span><span class='tag'>pre</span><span class='punct'>&gt;</span>
142
+ </pre><p>One level of indentation -- 4 spaces or 1 tab -- is removed from each line of the code block. For example, this:</p><pre style='background-color: #f0f0e0;'>Here is an example of AppleScript:
143
+
144
+ tell application &quot;Foo&quot;
145
+ beep
146
+ end tell
147
+ </pre><p>will turn into:</p><pre class='xml' style='background-color: #f0f0e0;'><span class='punct'>&lt;</span><span class='tag'>p</span><span class='punct'>&gt;</span>Here is an example of AppleScript:<span class='punct'>&lt;/</span><span class='tag'>p</span><span class='punct'>&gt;</span>
148
+
149
+ <span class='punct'>&lt;</span><span class='tag'>pre</span><span class='punct'>&gt;&lt;</span><span class='tag'>code</span><span class='punct'>&gt;</span>tell application &quot;Foo&quot;
150
+ beep
151
+ end tell
152
+ <span class='punct'>&lt;/</span><span class='tag'>code</span><span class='punct'>&gt;&lt;/</span><span class='tag'>pre</span><span class='punct'>&gt;</span>
153
+ </pre><p>A code block continues until it reaches a line that is not indented (or the end of the article).</p><p>Within a code block, ampersands (<tt style='background-color: #f0f0e0;'>&amp;</tt>) and angle brackets (<tt style='background-color: #f0f0e0;'>&lt;</tt> and <tt style='background-color: #f0f0e0;'>&gt;</tt>) are automatically converted into HTML entities. This makes it very easy to include example HTML source code using Markdown -- just paste it and indent it, and Markdown will handle the hassle of encoding the ampersands and angle brackets. For example, this:</p><pre style='background-color: #f0f0e0;'> &lt;div class=&quot;footer&quot;&gt;
154
+ &amp;copy; 2004 Foo Corporation
155
+ &lt;/div&gt;
156
+ </pre><p>will turn into:</p><pre class='xml' style='background-color: #f0f0e0;'><span class='punct'>&lt;</span><span class='tag'>pre</span><span class='punct'>&gt;&lt;</span><span class='tag'>code</span><span class='punct'>&gt;</span><span class='entity'>&amp;lt;</span>div class=&quot;footer&quot;<span class='entity'>&amp;gt;</span>
157
+ <span class='entity'>&amp;amp;copy;</span> 2004 Foo Corporation
158
+ <span class='entity'>&amp;lt;/div&amp;gt;</span>
159
+ <span class='punct'>&lt;/</span><span class='tag'>code</span><span class='punct'>&gt;&lt;/</span><span class='tag'>pre</span><span class='punct'>&gt;</span>
160
+ </pre><p>Regular Markdown syntax is not processed within code blocks. E.g., asterisks are just literal asterisks within a code block. This means it&apos;s also easy to use Markdown to write about Markdown&apos;s own syntax.</p><h3 id='hr'>Horizontal Rules</h3><p>You can produce a horizontal rule tag (<tt style='background-color: #f0f0e0;'>&lt;hr /&gt;</tt>) by placing three or more hyphens or asterisks on a line by themselves. If you wish, you may use spaces between the hyphens or asterisks. Each of the following lines will produce a horizontal rule:</p><pre style='background-color: #f0f0e0;'>* * *
161
+
162
+ ***
163
+
164
+ *****
165
+
166
+ - - -
167
+
168
+ ---------------------------------------
169
+
170
+ </pre><hr /><h2 id='span'>Span Elements</h2><h3 id='link'>Links</h3><p>Markdown supports two style of links: <em>inline</em> and <em>reference</em>.</p><p>In both styles, the link text is delimited by [square brackets].</p><p>To create an inline link, use a set of regular parentheses immediately after the link text&apos;s closing square bracket. Inside the parentheses, put the URL where you want the link to point, along with an <em>optional</em> title for the link, surrounded in quotes. For example:</p><pre style='background-color: #f0f0e0;'>This is [an example](http://example.com/ &quot;Title&quot;) inline link.
171
+
172
+ [This link](http://example.net/) has no title attribute.
173
+ </pre><p>Will produce:</p><pre class='xml' style='background-color: #f0f0e0;'><span class='punct'>&lt;</span><span class='tag'>p</span><span class='punct'>&gt;</span>This is <span class='punct'>&lt;</span><span class='tag'>a</span> <span class='attribute'>href</span><span class='punct'>=&quot;</span><span class='string'>http://example.com/</span><span class='punct'>&quot;</span> <span class='attribute'>title</span><span class='punct'>=&quot;</span><span class='string'>Title</span><span class='punct'>&quot;&gt;</span>
174
+ an example<span class='punct'>&lt;/</span><span class='tag'>a</span><span class='punct'>&gt;</span> inline link.<span class='punct'>&lt;/</span><span class='tag'>p</span><span class='punct'>&gt;</span>
175
+
176
+ <span class='punct'>&lt;</span><span class='tag'>p</span><span class='punct'>&gt;&lt;</span><span class='tag'>a</span> <span class='attribute'>href</span><span class='punct'>=&quot;</span><span class='string'>http://example.net/</span><span class='punct'>&quot;&gt;</span>This link<span class='punct'>&lt;/</span><span class='tag'>a</span><span class='punct'>&gt;</span> has no
177
+ title attribute.<span class='punct'>&lt;/</span><span class='tag'>p</span><span class='punct'>&gt;</span>
178
+ </pre><p>If you&apos;re referring to a local resource on the same server, you can use relative paths:</p><pre style='background-color: #f0f0e0;'>See my [About](/about/) page for details.
179
+ </pre><p>Reference-style links use a second set of square brackets, inside which you place a label of your choosing to identify the link:</p><pre style='background-color: #f0f0e0;'>This is [an example][id] reference-style link.
180
+ </pre><p>You can optionally use a space to separate the sets of brackets:</p><pre style='background-color: #f0f0e0;'>This is [an example] [id] reference-style link.
181
+ </pre><p>Then, anywhere in the document, you define your link label like this, on a line by itself:</p><pre style='background-color: #f0f0e0;'>[id]: http://example.com/ &quot;Optional Title Here&quot;
182
+ </pre><p>That is:</p><ul><li>Square brackets containing the link identifier (optionally indented from the left margin using spaces or tabs);</li><li>followed by a colon;</li><li>followed by one or more spaces (or tabs);</li><li>followed by the URL for the link;</li><li>optionally followed by a title attribute for the link, enclosed in double or single quotes, or enclosed in parentheses.</li></ul><p>The following three link definitions are equivalent:</p><pre style='background-color: #f0f0e0;'>[foo]: http://example.com/ &quot;Optional Title Here&quot;
183
+ [foo]: http://example.com/ &apos;Optional Title Here&apos;
184
+ [foo]: http://example.com/ (Optional Title Here)
185
+ </pre><p><strong>Note:</strong> There is a known bug in Markdown 1.0.1 which prevents single quotes from being used to delimit link titles.</p><p>The link URL may, optionally, be surrounded by angle brackets:</p><pre style='background-color: #f0f0e0;'>[id]: &lt;http://example.com/&gt; &quot;Optional Title Here&quot;
186
+ </pre><p>You can put the title attribute on the next line and use extra spaces or tabs for padding, which tends to look better with longer URLs:</p><pre style='background-color: #f0f0e0;'>[id]: http://example.com/longish/path/to/resource/here
187
+ &quot;Optional Title Here&quot;
188
+ </pre><p>Link definitions are only used for creating links during Markdown processing, and are stripped from your document in the HTML output.</p><p>Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are <em>not</em> case sensitive. E.g. these two links:</p><pre style='background-color: #f0f0e0;'>[link text][a]
189
+ [link text][A]
190
+ </pre><p>are equivalent.</p><p>The <em>implicit link name</em> shortcut allows you to omit the name of the link, in which case the link text itself is used as the name. Just use an empty set of square brackets -- e.g., to link the word &quot;Google&quot; to the google.com web site, you could simply write:</p><pre style='background-color: #f0f0e0;'>[Google][]
191
+ </pre><p>And then define the link:</p><pre style='background-color: #f0f0e0;'>[Google]: http://google.com/
192
+ </pre><p>Because link names may contain spaces, this shortcut even works for multiple words in the link text:</p><pre style='background-color: #f0f0e0;'>Visit [Daring Fireball][] for more information.
193
+ </pre><p>And then define the link:</p><pre style='background-color: #f0f0e0;'>
194
+ [Daring Fireball]: http://daringfireball.net/
195
+ </pre><p>Link definitions can be placed anywhere in your Markdown document. I tend to put them immediately after each paragraph in which they&apos;re used, but if you want, you can put them all at the end of your document, sort of like footnotes.</p><p>Here&apos;s an example of reference links in action:</p><pre style='background-color: #f0f0e0;'>I get 10 times more traffic from [Google] [1] than from
196
+ [Yahoo] [2] or [MSN] [3].
197
+
198
+ [1]: http://google.com/ &quot;Google&quot;
199
+ [2]: http://search.yahoo.com/ &quot;Yahoo Search&quot;
200
+ [3]: http://search.msn.com/ &quot;MSN Search&quot;
201
+ </pre><p>Using the implicit link name shortcut, you could instead write:</p><pre style='background-color: #f0f0e0;'>I get 10 times more traffic from [Google][] than from
202
+ [Yahoo][] or [MSN][].
203
+
204
+ [google]: http://google.com/ &quot;Google&quot;
205
+ [yahoo]: http://search.yahoo.com/ &quot;Yahoo Search&quot;
206
+ [msn]: http://search.msn.com/ &quot;MSN Search&quot;
207
+ </pre><p>Both of the above examples will produce the following HTML output:</p><pre style='background-color: #f0f0e0;'>&lt;p&gt;I get 10 times more traffic from &lt;a href=&quot;http://google.com/&quot;
208
+ title=&quot;Google&quot;&gt;Google&lt;/a&gt; than from
209
+ &lt;a href=&quot;http://search.yahoo.com/&quot; title=&quot;Yahoo Search&quot;&gt;Yahoo&lt;/a&gt;
210
+ or &lt;a href=&quot;http://search.msn.com/&quot; title=&quot;MSN Search&quot;&gt;MSN&lt;/a&gt;.&lt;/p&gt;
211
+ </pre><p>For comparison, here is the same paragraph written using Markdown&apos;s inline link style:</p><pre style='background-color: #f0f0e0;'>I get 10 times more traffic from [Google](http://google.com/ &quot;Google&quot;)
212
+ than from [Yahoo](http://search.yahoo.com/ &quot;Yahoo Search&quot;) or
213
+ [MSN](http://search.msn.com/ &quot;MSN Search&quot;).
214
+ </pre><p>The point of reference-style links is not that they&apos;re easier to write. The point is that with reference-style links, your document source is vastly more readable. Compare the above examples: using reference-style links, the paragraph itself is only 81 characters long; with inline-style links, it&apos;s 176 characters; and as raw HTML, it&apos;s 234 characters. In the raw HTML, there&apos;s more markup than there is text.</p><p>With Markdown&apos;s reference-style links, a source document much more closely resembles the final output, as rendered in a browser. By allowing you to move the markup-related metadata out of the paragraph, you can add links without interrupting the narrative flow of your prose.</p><h3 id='em'>Emphasis</h3><p>Markdown treats asterisks (<tt style='background-color: #f0f0e0;'>*</tt>) and underscores (<tt style='background-color: #f0f0e0;'>_</tt>) as indicators of emphasis. Text wrapped with one <tt style='background-color: #f0f0e0;'>*</tt> or <tt style='background-color: #f0f0e0;'>_</tt> will be wrapped with an HTML <tt style='background-color: #f0f0e0;'>&lt;em&gt;</tt> tag; double <tt style='background-color: #f0f0e0;'>*</tt>&apos;s or <tt style='background-color: #f0f0e0;'>_</tt>&apos;s will be wrapped with an HTML <tt style='background-color: #f0f0e0;'>&lt;strong&gt;</tt> tag. E.g., this input:</p><pre style='background-color: #f0f0e0;'>*single asterisks*
215
+
216
+ _single underscores_
217
+
218
+ **double asterisks**
219
+
220
+ __double underscores__
221
+ </pre><p>will produce:</p><pre class='xml' style='background-color: #f0f0e0;'><span class='punct'>&lt;</span><span class='tag'>em</span><span class='punct'>&gt;</span>single asterisks<span class='punct'>&lt;/</span><span class='tag'>em</span><span class='punct'>&gt;</span>
222
+
223
+ <span class='punct'>&lt;</span><span class='tag'>em</span><span class='punct'>&gt;</span>single underscores<span class='punct'>&lt;/</span><span class='tag'>em</span><span class='punct'>&gt;</span>
224
+
225
+ <span class='punct'>&lt;</span><span class='tag'>strong</span><span class='punct'>&gt;</span>double asterisks<span class='punct'>&lt;/</span><span class='tag'>strong</span><span class='punct'>&gt;</span>
226
+
227
+ <span class='punct'>&lt;</span><span class='tag'>strong</span><span class='punct'>&gt;</span>double underscores<span class='punct'>&lt;/</span><span class='tag'>strong</span><span class='punct'>&gt;</span>
228
+ </pre><p>You can use whichever style you prefer; the lone restriction is that the same character must be used to open and close an emphasis span.</p><p>Emphasis can be used in the middle of a word:</p><pre style='background-color: #f0f0e0;'>un*fucking*believable
229
+ </pre><p>But if you surround an <tt style='background-color: #f0f0e0;'>*</tt> or <tt style='background-color: #f0f0e0;'>_</tt> with spaces, it&apos;ll be treated as a literal asterisk or underscore.</p><p>To produce a literal asterisk or underscore at a position where it would otherwise be used as an emphasis delimiter, you can backslash escape it:</p><pre style='background-color: #f0f0e0;'>\*this text is surrounded by literal asterisks\*
230
+
231
+
232
+ </pre><h3 id='code'>Code</h3><p>To indicate a span of code, wrap it with backtick quotes (<tt style='background-color: #f0f0e0;'> ` </tt>). Unlike a pre-formatted code block, a code span indicates code within a normal paragraph. For example:</p><pre style='background-color: #f0f0e0;'>Use the `printf()` function.
233
+ </pre><p>will produce:</p><pre class='xml' style='background-color: #f0f0e0;'><span class='punct'>&lt;</span><span class='tag'>p</span><span class='punct'>&gt;</span>Use the <span class='punct'>&lt;</span><span class='tag'>code</span><span class='punct'>&gt;</span>printf()<span class='punct'>&lt;/</span><span class='tag'>code</span><span class='punct'>&gt;</span> function.<span class='punct'>&lt;/</span><span class='tag'>p</span><span class='punct'>&gt;</span>
234
+ </pre><p>To include a literal backtick character within a code span, you can backslash escape it:</p><pre style='background-color: #f0f0e0;'>`There is a literal backtick (\\`) here.`
235
+ </pre><p>Or, if you prefer, you can use multiple backticks as the opening and closing delimiters:</p><pre style='background-color: #f0f0e0;'>``There is a literal backtick (`) here.``
236
+ </pre><p>Both of the previous two examples will produce this:</p><pre class='xml' style='background-color: #f0f0e0;'><span class='punct'>&lt;</span><span class='tag'>p</span><span class='punct'>&gt;&lt;</span><span class='tag'>code</span><span class='punct'>&gt;</span>There is a literal backtick (`) here.<span class='punct'>&lt;/</span><span class='tag'>code</span><span class='punct'>&gt;&lt;/</span><span class='tag'>p</span><span class='punct'>&gt;</span>
237
+ </pre><p>With a code span, ampersands and angle brackets are encoded as HTML entities automatically, which makes it easy to include example HTML tags. Markdown will turn this:</p><pre style='background-color: #f0f0e0;'>Please don&apos;t use any `&lt;blink&gt;` tags.
238
+ </pre><p>into:</p><pre class='xml' style='background-color: #f0f0e0;'><span class='punct'>&lt;</span><span class='tag'>p</span><span class='punct'>&gt;</span>Please don't use any <span class='punct'>&lt;</span><span class='tag'>code</span><span class='punct'>&gt;</span><span class='entity'>&amp;lt;</span>blink<span class='entity'>&amp;gt;</span><span class='punct'>&lt;/</span><span class='tag'>code</span><span class='punct'>&gt;</span> tags.<span class='punct'>&lt;/</span><span class='tag'>p</span><span class='punct'>&gt;</span>
239
+ </pre><p>You can write this:</p><pre style='background-color: #f0f0e0;'>`&amp;#8212;` is the decimal-encoded equivalent of `&amp;mdash;`.
240
+ </pre><p>to produce:</p><pre class='xml' style='background-color: #f0f0e0;'><span class='punct'>&lt;</span><span class='tag'>p</span><span class='punct'>&gt;&lt;</span><span class='tag'>code</span><span class='punct'>&gt;</span><span class='entity'>&amp;amp;#8212;</span><span class='punct'>&lt;/</span><span class='tag'>code</span><span class='punct'>&gt;</span> is the decimal-encoded
241
+ equivalent of <span class='punct'>&lt;</span><span class='tag'>code</span><span class='punct'>&gt;</span><span class='entity'>&amp;amp;mdash;</span><span class='punct'>&lt;/</span><span class='tag'>code</span><span class='punct'>&gt;</span>.<span class='punct'>&lt;/</span><span class='tag'>p</span><span class='punct'>&gt;</span>
242
+
243
+
244
+ </pre><h3 id='img'>Images</h3><p>Admittedly, it&apos;s fairly difficult to devise a &quot;natural&quot; syntax for placing images into a plain text document format.</p><p>Markdown uses an image syntax that is intended to resemble the syntax for links, allowing for two styles: <em>inline</em> and <em>reference</em>.</p><p>Inline image syntax looks like this:</p><pre style='background-color: #f0f0e0;'>![Alt text](/path/to/img.jpg)
245
+
246
+ ![Alt text](/path/to/img.jpg &quot;Optional title&quot;)
247
+ </pre><p>That is:</p><ul><li>An exclamation mark: <tt style='background-color: #f0f0e0;'>!</tt>;</li><li>followed by a set of square brackets, containing the <tt style='background-color: #f0f0e0;'>alt</tt> attribute text for the image;</li><li>followed by a set of parentheses, containing the URL or path to the image, and an optional <tt style='background-color: #f0f0e0;'>title</tt> attribute enclosed in double or single quotes.</li></ul><p>Reference-style image syntax looks like this:</p><pre style='background-color: #f0f0e0;'>![Alt text][id]
248
+ </pre><p>Where &quot;id&quot; is the name of a defined image reference. Image references are defined using syntax identical to link references:</p><pre style='background-color: #f0f0e0;'>[id]: url/to/image &quot;Optional title attribute&quot;
249
+ </pre><p>As of this writing, Markdown has no syntax for specifying the dimensions of an image; if this is important to you, you can simply use regular HTML <tt style='background-color: #f0f0e0;'>&lt;img&gt;</tt> tags.</p><hr /><h2 id='misc'>Miscellaneous</h2><h3 id='autolink'>Automatic Links</h3><p>Markdown supports a shortcut style for creating &quot;automatic&quot; links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:</p><pre style='background-color: #f0f0e0;'>&lt;http://example.com/&gt;</pre><p>Markdown will turn this into:</p><pre class='xml' style='background-color: #f0f0e0;'><span class='punct'>&lt;</span><span class='tag'>a</span> <span class='attribute'>href</span><span class='punct'>=&quot;</span><span class='string'>http://example.com/</span><span class='punct'>&quot;&gt;</span>http://example.com/<span class='punct'>&lt;/</span><span class='tag'>a</span><span class='punct'>&gt;</span>
250
+ </pre><p>Automatic links for email addresses work similarly, except that Markdown will also perform a bit of randomized decimal and hex entity-encoding to help obscure your address from address-harvesting spambots. For example, Markdown will turn this:</p><pre style='background-color: #f0f0e0;'>&lt;address@example.com&gt;
251
+ </pre><p>into something like this:</p><pre class='xml' style='background-color: #f0f0e0;'><span class='punct'>&lt;</span><span class='tag'>a</span> <span class='attribute'>href</span><span class='punct'>=&quot;</span><span class='entity'>&amp;#x6D;&amp;#x61;</span><span class='string'>i</span><span class='entity'>&amp;#x6C;&amp;#x74;&amp;#x6F;</span><span class='string'>:</span><span class='entity'>&amp;#x61;&amp;#x64;&amp;#x64;&amp;#x72;&amp;#x65;</span><span class='string'>
252
+ </span><span class='entity'>&amp;#115;&amp;#115;&amp;#64;&amp;#101;&amp;#120;&amp;#x61;&amp;#109;&amp;#x70;&amp;#x6C;</span><span class='string'>e</span><span class='entity'>&amp;#x2E;&amp;#99;&amp;#111;</span><span class='string'>
253
+ </span><span class='entity'>&amp;#109;</span><span class='punct'>&quot;&gt;</span><span class='entity'>&amp;#x61;&amp;#x64;&amp;#x64;&amp;#x72;&amp;#x65;&amp;#115;&amp;#115;&amp;#64;&amp;#101;&amp;#120;&amp;#x61;</span>
254
+ <span class='entity'>&amp;#109;&amp;#x70;&amp;#x6C;</span>e<span class='entity'>&amp;#x2E;&amp;#99;&amp;#111;&amp;#109;</span><span class='punct'>&lt;/</span><span class='tag'>a</span><span class='punct'>&gt;</span>
255
+ </pre><p>which will render in a browser as a clickable link to &quot;address@example.com&quot;.</p><p>(This sort of entity-encoding trick will indeed fool many, if not most, address-harvesting bots, but it definitely won&apos;t fool all of them. It&apos;s better than nothing, but an address published in this way will probably eventually start receiving spam.)</p><h3 id='backslash'>Backslash Escapes</h3><p>Markdown allows you to use backslash escapes to generate literal characters which would otherwise have special meaning in Markdown&apos;s formatting syntax. For example, if you wanted to surround a word with literal asterisks (instead of an HTML <tt style='background-color: #f0f0e0;'>&lt;em&gt;</tt> tag), you can backslashes before the asterisks, like this:</p><pre style='background-color: #f0f0e0;'>\*literal asterisks\*
256
+ </pre><p>Markdown provides backslash escapes for the following characters:</p><pre style='background-color: #f0f0e0;'>\ backslash
257
+ ` backtick
258
+ * asterisk
259
+ _ underscore
260
+ {} curly braces
261
+ [] square brackets
262
+ () parentheses
263
+ # hash mark
264
+ . dot
265
+ ! exclamation mark
266
+ </pre></body></html>