maruku 0.2.12 → 0.2.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,118 @@
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 id='maruku_a_markdown_interpreter'>Mar<strong>u</strong>k<strong>u</strong>: a Markdown interpreter</h1><p><a href='http://maruku.rubyforge.org/&gt;'>Maruku</a> 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:</p><ul><li><p>the original <a href='http://daringfireball.net/projects/markdown/syntax'>Markdown syntax</a> (<a href='http://maruku.rubyforge.org/markdown_syntax.html'>HTML</a> o <a href='http://maruku.rubyforge.org/markdown_syntax.pdf'>PDF</a>, translated by Maruku)</p></li><li><p>all the improvements in <a href='http://www.michelf.com/projects/php-markdown/extra/'>PHP Markdown Extra</a>.</p></li><li><p>a new <a href='#meta'>meta-data syntax</a></p></li><li><p>some ideas from <a href='http://fletcher.freeshell.org/wiki/MultiMarkdown'>MultiMarkdown</a></p><ul><li>attributes in image links</li></ul></li></ul><p>The <a href='http://maruku.rubyforge.org/tests/'>test directory</a> is quite messy but it shows every capability.</p><h3 id='authors'>Authors</h3><p>Maruku has been developed so far by <a href='http://www.dis.uniroma1.it/~acensi/'>Andrea Censi</a>. Contributors are most welcome!</p><hr /><p>Table of contents: (<strong>auto-generated by Maruku!</strong>)</p><div class='maruku_toc'><ul style='list-style: none;'><li><span class='maruku_section_number'>1. </span><a href='#download' class='head'>Download</a><ul style='list-style: none;'><li><span class='maruku_section_number'>1.1. </span><a href='#bugs_report'>Bugs report</a></li></ul></li><li><span class='maruku_section_number'>2. </span><a href='#usage'>Usage</a><ul style='list-style: none;'><li><span class='maruku_section_number'>2.1. </span><a href='#from_the_command_line'>From the command line</a></li></ul></li><li><span class='maruku_section_number'>3. </span><a href='#extra'>Examples of PHP Markdown Extra syntax</a></li><li><span class='maruku_section_number'>4. </span><a href='#maruku-and-bluecloth'>Maruku and Bluecloth</a></li><li><span class='maruku_section_number'>5. </span><a href='#meta'>New meta-data syntax</a><ul style='list-style: none;'><li><span class='maruku_section_number'>5.1. </span><a href='#metadata_for_the_document'>Meta-data for the document</a></li><li><span class='maruku_section_number'>5.2. </span><a href='#metadata_for_elements'>Meta-data for elements</a></li><li><span class='maruku_section_number'>5.3. </span><a href='#shortcuts'>Shortcuts</a></li><li><span class='maruku_section_number'>5.4. </span><a href='#metalist'>List of meta-data</a></li><li><span class='maruku_section_number'>5.5. </span><a href='#examples'>Examples</a></li></ul></li><li><span class='maruku_section_number'>6. </span><a href='#features'>Other Features</a><ul style='list-style: none;'><li><span class='maruku_section_number'>6.1. </span><a href='#automatic_generation_of_the_table_of_contents'>Automatic generation of the table of contents</a></li><li><span class='maruku_section_number'>6.2. </span><a href='#this_header_contains_emphasis_strong_text_and_'>This header contains <em>emphasis</em> <strong>strong text</strong> and <tt style='background-color: #f0f0e0;'>code</tt></a></li><li><span class='maruku_section_number'>6.3. </span><a href='#use_html_entities'>Use HTML entities</a></li></ul></li><li><span class='maruku_section_number'>7. </span><a href='#todo_list'>TODO list</a></li><li><span class='maruku_section_number'>8. </span><a href='#future'>Future developments</a><ul style='list-style: none;'><li><span class='maruku_section_number'>8.1. </span><a href='#a_syntax_for_specifying_metadata_for_spanlevel_elements'>A syntax for specifying meta-data for span-level elements</a></li><li><span class='maruku_section_number'>8.2. </span><a href='#a_syntax_for_commenting_parts_of_the_document'>A syntax for commenting parts of the document</a></li><li><span class='maruku_section_number'>8.3. </span><a href='#a_syntax_for_adding_math'>A syntax for adding math</a></li></ul></li></ul></div><hr /><h2 class='head' id='download'><span class='maruku_section_number'>1. </span>Download</h2><p>The development site is <a href='http://rubyforge.org/projects/maruku/'>http://rubyforge.org/projects/maruku/</a>.</p><p>Install with:</p><pre style='background-color: #f0f0e0;'>$ gem install maruku
5
+ </pre><p>Released files can also be seen at <a href='http://rubyforge.org/frs/?group_id=2795'>http://rubyforge.org/frs/?group_id=2795</a>.</p><p>Anonymous access to the repository is possible with:</p><pre style='background-color: #f0f0e0;'>$ svn checkout svn://rubyforge.org/var/svn/maruku
6
+ </pre><p>If you want commit access to the repository, just create an account on Rubyforge and <a href='http://www.dis.uniroma1.it/~acensi/contact.html'>drop me a mail</a>.</p><h3 id='bugs_report'><span class='maruku_section_number'>1.1. </span>Bugs report</h3><p>Use the <a href='http://rubyforge.org/tracker/?group_id=2795'>tracker</a> or <a href='http://www.dis.uniroma1.it/~acensi/contact.html'>drop me an email</a>.</p><h2 id='usage'><span class='maruku_section_number'>2. </span>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'>rubygems</span><span class='punct'>'</span>
7
+ <span class='ident'>require</span> <span class='punct'>'</span><span class='string'>maruku</span><span class='punct'>'</span>
8
+
9
+ <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>
10
+ <span class='ident'>puts</span> <span class='ident'>doc</span><span class='punct'>.</span><span class='ident'>to_html</span>
11
+ </pre><p>The method <tt style='background-color: #f0f0e0;'>to_html</tt> outputs only an HTML fragment, while the method <tt style='background-color: #f0f0e0;'>to_html_document</tt> 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>
12
+ </pre><h3 id='from_the_command_line'><span class='maruku_section_number'>2.1. </span>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><ul><li><p><tt style='background-color: #f0f0e0;'>maruku</tt> converts Markdown to HTML:</p><pre style='background-color: #f0f0e0;'>$ maruku file.md # creates file.html</pre></li><li><p><tt style='background-color: #f0f0e0;'>marutex</tt> converts Markdown to LaTeX, 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</pre></li></ul><h2 id='extra'><span class='maruku_section_number'>3. </span>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|
13
+ -----|:-------------------:|-------------------:|
14
+ cell | center-align | right-align |
15
+ </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]
16
+
17
+ [^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>
18
+ This is a div with Markdown **strong text**
19
+ <span class='punct'>&lt;/</span><span class='tag'>div</span><span class='punct'>&gt;</span>
20
+ </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;'>## Download ## {#download}</pre><p>For example, <a href='#download'>a link to the download</a> header.</p><p>Note that you can use also the new <a href='#meta'>meta-data syntax</a> for the same purpose:</p><pre style='background-color: #f0f0e0;'>@ id: download
21
+ ## Header ## </pre></li><li><p>definition lists</p><pre style='background-color: #f0f0e0;'>Definition list
22
+ : something very hard to parse
23
+ </pre><dl><dt>Definition list</dt><dd>something very hard to parse</dd></dl></li><li><p>abbreviations or <abbr title='Simply an abbreviation'>ABB</abbr> for short.</p></li></ul><h2 id='maruku-and-bluecloth'><span class='maruku_section_number'>4. </span>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.</p><p>The in-memory representation makes it very easy to export to various formats (at the moment HTML and LaTeX/PDF; the next is pretty-printed Markdown).</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'><span class='maruku_section_number'>5. </span>New meta-data syntax</h2><p>Maruku implements a syntax that allows to attach &quot;meta&quot; information to objects.</p><h3 id='metadata_for_the_document'><span class='maruku_section_number'>5.1. </span>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
24
+ CSS: style.css
25
+
26
+ Content of the document
27
+ </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>
28
+ </pre><p>the title and stylesheet are added as expected.</p><p>Meta-data keys are assumed to be case-insensitive.</p><h3 id='metadata_for_elements'><span class='maruku_section_number'>5.2. </span>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.
29
+
30
+ Paragraph 2
31
+ </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
32
+ Paragraph 1 is a warning
33
+
34
+ Paragraph 2
35
+
36
+ </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
37
+ Paragraph 1 is a warning
38
+ </pre><p>A meta-data declaration is composed of</p><ol><li>newline</li><li>an at-symbol <tt style='background-color: #f0f0e0;'>@</tt></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
39
+ @ id: warning1
40
+ Paragraph 1 is a warning
41
+ </pre><p>These can also be separated by newlines:</p><pre style='background-color: #f0f0e0;'>@ class: warning
42
+
43
+ @ id: warning1
44
+
45
+ Paragraph 1 is a warning
46
+
47
+ </pre><h3 id='shortcuts'><span class='maruku_section_number'>5.3. </span>Shortcuts</h3><p>This:</p><pre style='background-color: #f0f0e0;'>@ .xyz
48
+ Paragraph
49
+ </pre><p>is equivalent to:</p><pre style='background-color: #f0f0e0;'>@ class: xyz
50
+ Paragraph
51
+ </pre><p>This:</p><pre style='background-color: #f0f0e0;'>@ #xyz
52
+ Paragraph
53
+ </pre><p>is equivalent to:</p><pre style='background-color: #f0f0e0;'>@ id: xyz
54
+ Paragraph
55
+ </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
56
+
57
+ This paragraph has the attribute `test` set to `true`.
58
+ </pre><hr /><h3 id='metalist'><span class='maruku_section_number'>5.4. </span>List of meta-data</h3><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 (HTML: used in the <tt style='background-color: #f0f0e0;'>TITLE</tt> element).</p></dd><dt><strong><tt style='background-color: #f0f0e0;'>use_numbered_headers</tt></strong></dt><dd><p>(document) If <tt style='background-color: #f0f0e0;'>true</tt>, headers are numbered (just like this document). Default is <tt style='background-color: #f0f0e0;'>false</tt>.</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;'>html_use_syntax</tt></strong></dt><dd><p>(document, HTML) If set, use the <a href='http://syntax.rubyforge.org/'>Ruby <tt style='background-color: #f0f0e0;'>syntax</tt> library</a> to add source highlighting.</p></dd><dt><strong><tt style='background-color: #f0f0e0;'>latex_use_listings</tt></strong></dt><dd><p>(document, LaTeX) If set, use the fancy <a href='http://www.ctan.org/tex-archive/macros/latex/contrib/listings/'><tt style='background-color: #f0f0e0;'>listings</tt> package</a> for better displaying code blocks.</p><p>If not set, use standard <tt style='background-color: #f0f0e0;'>verbatim</tt> environment.</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.</p><p>Default for this is <tt style='background-color: #f0f0e0;'>code_lang</tt> in document.</p><p>Syntax highlighting is delegated to the <a href='http://syntax.rubyforge.org/'><tt style='background-color: #f0f0e0;'>syntax</tt> library</a> for HTML output and to the <a href='http://www.ctan.org/tex-archive/macros/latex/contrib/listings/'><tt style='background-color: #f0f0e0;'>listings</tt> package</a> for LaTeX output.</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;'>\color[rgb]{r,g,b}</tt> macro.</p><p>For example, for <tt style='background-color: #f0f0e0;'>#0000ff</tt>, the macro is called as: <tt style='background-color: #f0f0e0;'>\color[rgb]{0,0,1}</tt>.</p></li></ul></dd></dl><h3 id='examples'><span class='maruku_section_number'>5.5. </span>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
59
+
60
+ &raquo;&nbsp;&nbsp;&nbsp;&not;One&not;space
61
+ &raquo;&nbsp;&nbsp;&nbsp;&not;&not;Two&not;spaces
62
+ &raquo;&nbsp;&nbsp;&nbsp;&raquo;&nbsp;&nbsp;&nbsp;&not;&raquo;&nbsp;&nbsp;&nbsp;Tab,&not;space,&not;tab
63
+ &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!
64
+ </pre><p>That will produce:</p><pre style='background-color: green;'>&not;One&not;space
65
+ &not;&not;Two&not;spaces
66
+ &raquo;&nbsp;&nbsp;&nbsp;&not;&raquo;&nbsp;&nbsp;&nbsp;Tab,&not;space,&not;tab
67
+ &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!
68
+ </pre><p>Example with css-style color:</p><pre style='background-color: #f0f0e0;'>@ code_background_color: #455678
69
+
70
+ A strange color
71
+ </pre><p>produces:</p><pre style='background-color: #455678;'>A strange color
72
+ </pre><p>Or highlighting (does not work well yet):</p><pre style='background-color: #f0f0e0;'>@ lang: xml
73
+ &lt;div style=&quot;text-align:center&quot;&gt;Div&lt;/div&gt;
74
+ </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>
75
+
76
+
77
+ </pre><hr /><h2 id='features'><span class='maruku_section_number'>6. </span>Other Features</h2><h3 id='automatic_generation_of_the_table_of_contents'><span class='maruku_section_number'>6.1. </span>Automatic generation of the table of contents</h3><p>If you create a list, and then set the <tt style='background-color: #f0f0e0;'>toc</tt> attribute, when rendering Maruku will create an auto-generated table of contents.</p><pre style='background-color: #f0f0e0;'>@ toc
78
+ * This will become a table of contents (this text will be scraped).
79
+ </pre><p>You can see an example of this at the beginning of this document.</p><h3 id='this_header_contains_emphasis_strong_text_and_'><span class='maruku_section_number'>6.2. </span>This header contains <em>emphasis</em> <strong>strong text</strong> and <tt style='background-color: #f0f0e0;'>code</tt></h3><p>Note that this header contains formatting and it still works, also in the table of contents.</p><p>And <a href='#features'>This is a <em>link</em> with <strong>all</strong> <strong><em>sort</em></strong> of <tt style='background-color: #f0f0e0;'>weird stuff</tt></a> in the text.</p><h3 id='use_html_entities'><span class='maruku_section_number'>6.3. </span>Use HTML entities</h3><p>If you want to use HTML entities, go on! We will take care of the translation to LaTeX:</p><table><thead><tr><th>Entity</th><th>Result</th></tr></thead><tbody><tr><td style='text-align: left;'><tt style='background-color: #f0f0e0;'>&amp;copy;</tt></td><td style='text-align: left;'>&copy;</td></tr><tr><td style='text-align: left;'><tt style='background-color: #f0f0e0;'>&amp;pound;</tt></td><td style='text-align: left;'>&pound;</td></tr><tr><td style='text-align: left;'><tt style='background-color: #f0f0e0;'>a&amp;nbsp;b</tt></td><td style='text-align: left;'>a&nbsp;b</td></tr><tr><td style='text-align: left;'><tt style='background-color: #f0f0e0;'>&amp;lambda;</tt></td><td style='text-align: left;'>&lambda;</td></tr><tr><td style='text-align: left;'><tt style='background-color: #f0f0e0;'>&amp;mdash;</tt></td><td style='text-align: left;'>&mdash;</td></tr></tbody></table><h2 id='todo_list'><span class='maruku_section_number'>7. </span>TODO list</h2><ul><li><p>Export to HTML</p><ol><li><p>Add <tt style='background-color: #f0f0e0;'>-split</tt> options to <tt style='background-color: #f0f0e0;'>maruku</tt> that splits the document over multiple pages.</p><p>This should require the possibility of specifying a template for navigational elements. Investigate template engine.</p></li><li><p>Include RubyPants</p></li></ol></li><li><p>Export to PDF</p><ul><li>support for images</li></ul></li><li><p>Export to Markdown (pretty-printing)</p></li></ul><h2 id='future'><span class='maruku_section_number'>8. </span>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='a_syntax_for_specifying_metadata_for_spanlevel_elements'><span class='maruku_section_number'>8.1. </span>A syntax for specifying meta-data for span-level elements</h3><p>Maybe something like this:</p><pre style='background-color: #f0f0e0;'>This is a paragraph. Really, a normal paragraph. The second
80
+ line of this paragraph has the last element {with meta data}@ class: important_span
81
+ and the paragraph continues...
82
+ </pre><p>So the idea is:</p><ul><li><p>Only elements at the end of the line can have meta data.</p></li><li><p>Syntax is:</p><ol><li>Opening brace <tt style='background-color: #f0f0e0;'>{</tt>.</li><li>Any string that does not contain the sequence <tt style='background-color: #f0f0e0;'>}@</tt>.</li><li>Closing brace and at-symbol <tt style='background-color: #f0f0e0;'>}@</tt>.</li><li>Attributes specification like the block-level metadata.</li></ol></li></ul><p>Or, we could allow metadata specified <strong>after the text</strong>. In the following, three fragments are marked as &quot;special&quot;, and, after their containing block-level elements, their attributes are set:</p><pre style='background-color: #f0f0e0;'>Lorem ipsum dolor sit @{amet}, consectetuer adipiscing
83
+ elit. Donec sit amet sapien vitae augue @{interdum hendrerit.}
84
+ Maecenas tempor ultrices nisl. @{Praesent laoreet tortor sit
85
+ amet est.} Praesent in nisl eu libero sodales bibendum.
86
+
87
+ @{1} id: amet
88
+ @{2} style: &quot;font-style: bold&quot;
89
+ @{3} class: warning
90
+ </pre><p>We can be much liberal in the syntax. For example, instead of numeric references to the part in the text, we could write:</p><pre style='background-color: #f0f0e0;'>Lorem ipsum dolor sit @{amet}, consectetuer adipiscing
91
+ elit. Donec sit amet sapien vitae augue @{interdum hendrerit.}
92
+ Maecenas tempor ultrices nisl. @{Praesent laoreet tortor sit
93
+ amet est.} Praesent in nisl eu libero sodales bibendum.
94
+
95
+ @{amet} id: amet
96
+ @{interdum ...} style: &quot;font-style: bold&quot;
97
+ @{Praesent ...} class: warning
98
+ </pre><p>with <tt style='background-color: #f0f0e0;'>...</tt> acting as a wildcard, to match a long phrase (<tt style='background-color: #f0f0e0;'>{ Praesent laoreet tortor sit amet est.}</tt>) without specifying the full text.</p><p>I feel this is very readable and not intrusive. But then again, subjective tastes vary. Let me know of any comments and suggestions. I want to wait for feedback before implementing this.</p><h3 id='a_syntax_for_commenting_parts_of_the_document'><span class='maruku_section_number'>8.2. </span>A syntax for commenting parts of the document</h3><pre style='background-color: #f0f0e0;'>This is a paragraph
99
+ % This is a comment
100
+ </pre><p>Or <tt style='background-color: #f0f0e0;'>%</tt> on a line by itself comments the following block:</p><pre style='background-color: #f0f0e0;'>% The following paragraph is ignored
101
+
102
+ %
103
+ Lorem ipsum dolor sit amet, consectetuer adipiscing
104
+ elit. Donec sit amet sapien vitae augue interdum hendrerit.
105
+ Maecenas tempor ultrices nisl. Praesent laoreet tortor sit
106
+ amet est. Praesent in nisl eu libero sodales bibendum.
107
+
108
+ This paragraph is not ignored.
109
+ </pre><h3 id='a_syntax_for_adding_math'><span class='maruku_section_number'>8.3. </span>A syntax for adding math</h3><p>Something inspired from LaTeX should be familiar to all:</p><pre style='background-color: #f0f0e0;'>This is inline math: $\alpha$
110
+
111
+
112
+ This is an equation with label:
113
+
114
+ $ \alpha = \beta + \gamma $ (eq:1)
115
+
116
+ This is a reference to equation: please see (eq:1)
117
+
118
+ </pre><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></ol></div><div class='maruku_signature'><hr /><span style='font-size: small; font-style: italic'>Created by <a href='http://maruku.rubyforge.org' title='Maruku: a Markdown interpreter'>Maruku</a> at 16:59 on Friday, December 29th, 2006.</span></div></body></html>
@@ -0,0 +1,34 @@
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><h2 id='syntax_for_metadata'>Syntax for meta-data</h2><h3 id='shortcuts'>Shortcuts</h3><p>One sure thing is that in attributes list <tt style='background-color: #f0f0e0;'>#myid</tt> is a shortcut for <tt style='background-color: #f0f0e0;'>id: myid</tt> and <tt style='background-color: #f0f0e0;'>.myclass</tt> is a shortcut for <tt style='background-color: #f0f0e0;'>class: myclass</tt>.</p><h3 id='metadata_for_headers'>Meta-data for headers</h3><p>For headers, you want to put metadata in the <tt style='background-color: #f0f0e0;'>{}</tt> on the same line:</p><pre style='background-color: #f0f0e0;'>### Header ### {#myid}
5
+
6
+ Header {#myid .myclass}
7
+ ------
8
+ </pre><h3 id='metadata_for_blocklevel_elements'>Meta-data for block-level elements</h3><p>For paragraphs and other block-level elements, you want to put the <tt style='background-color: #f0f0e0;'>{}</tt> on the line below:</p><pre style='background-color: #f0f0e0;'>This is a paragraph.
9
+ Line 2 of the paragraph.
10
+
11
+ {#myid .myclass}
12
+
13
+ A quote with a citation url:
14
+ &gt; Who said that?
15
+ {cite=google.com}
16
+ </pre><h3 id='metadata_for_spanlevel_elements'>Meta-data for span-level elements</h3><p>Moreover, you want to use a similar syntax for span-level elements. For example, in this:</p><pre style='background-color: #f0f0e0;'>This is a paragraph. *chunky*{#id1}
17
+ {#id2}</pre><p>you are setting the id attribute to the <tt style='background-color: #f0f0e0;'>em</tt> element to <tt style='background-color: #f0f0e0;'>id1</tt> and the id of the paragraph to <tt style='background-color: #f0f0e0;'>id2</tt>.</p><p>This works also for links, like this:</p><pre style='background-color: #f0f0e0;'>This is [a link][ref]{#myid rel=abc rev=abc}
18
+ </pre><p>For images, it should be that</p><pre style='background-color: #f0f0e0;'>This is ![Alt text](url &quot;fresh carrots&quot;)
19
+ </pre><p>is equivalent to</p><pre style='background-color: #f0f0e0;'>This is ![Alt text](url){title=&quot;fresh carrots&quot;}
20
+ </pre><h3 id='using_references'>Using references</h3><p>Then, it is possible to use references: <tt style='background-color: #f0f0e0;'>{&lt;number&gt;}</tt> is threated as a reference (it is not ambiguous as attribute names cannot start with digits) and one can write:</p><pre style='background-color: #f0f0e0;'>### My header ### {1}
21
+ This is a paragraph with
22
+ para para para
23
+ {2}
24
+
25
+ {1}: #header-id
26
+ {2}: #paragraph-id</pre><p>which is equivalent to:</p><pre style='background-color: #f0f0e0;'>### My header ### {#header-id}
27
+ This is a paragraph with
28
+ para para para
29
+ {#paragraph-id}
30
+
31
+
32
+
33
+
34
+ </pre><div class='maruku_signature'><hr /><span style='font-size: small; font-style: italic'>Created by <a href='http://maruku.rubyforge.org' title='Maruku: a Markdown interpreter'>Maruku</a> at 17:00 on Friday, December 29th, 2006.</span></div></body></html>
@@ -0,0 +1,83 @@
1
+ CSS: style.css
2
+ LaTeX_use_listings: true
3
+ html_use_syntax: true
4
+
5
+ Syntax for meta-data
6
+ --------------------
7
+
8
+ ### Shortcuts ###
9
+
10
+ One sure thing is that in attributes list `#myid` is a shortcut
11
+ for `id: myid` and `.myclass` is a shortcut for `class: myclass`.
12
+
13
+ ### Meta-data for headers ###
14
+
15
+ For headers, you want to put metadata in the `{}` on the same line:
16
+
17
+ ### Header ### {#myid}
18
+
19
+ Header {#myid .myclass}
20
+ ------
21
+
22
+ ### Meta-data for block-level elements ###
23
+
24
+ For paragraphs and other block-level elements, you want to put
25
+ the `{}` on the line below:
26
+
27
+ This is a paragraph.
28
+ Line 2 of the paragraph.
29
+
30
+ {#myid .myclass}
31
+
32
+ A quote with a citation url:
33
+ > Who said that?
34
+ {cite=google.com}
35
+
36
+ ### Meta-data for span-level elements ###
37
+
38
+ Moreover, you want to use a similar syntax for span-level elements.
39
+ For example, in this:
40
+
41
+ This is a paragraph. *chunky*{#id1}
42
+ {#id2}
43
+
44
+ you are setting the id attribute to the `em` element to `id1`
45
+ and the id of the paragraph to `id2`.
46
+
47
+ This works also for links, like this:
48
+
49
+ This is [a link][ref]{#myid rel=abc rev=abc}
50
+
51
+ For images, it should be that
52
+
53
+ This is ![Alt text](url "fresh carrots")
54
+
55
+ is equivalent to
56
+
57
+ This is ![Alt text](url){title="fresh carrots"}
58
+
59
+ ### Using references ###
60
+
61
+ Then, it is possible to use references: `{<number>}` is threated
62
+ as a reference (it is not ambiguous as attribute names cannot start
63
+ with digits) and one can write:
64
+
65
+ ### My header ### {1}
66
+ This is a paragraph with
67
+ para para para
68
+ {2}
69
+
70
+ {1}: #header-id
71
+ {2}: #paragraph-id
72
+
73
+ which is equivalent to:
74
+
75
+ ### My header ### {#header-id}
76
+ This is a paragraph with
77
+ para para para
78
+ {#paragraph-id}
79
+
80
+
81
+
82
+
83
+
@@ -0,0 +1,265 @@
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>Markdown: Syntax</title><link href='style.css' rel='stylesheet' type='text/css' /></head><head><title>Markdown: Syntax</title><link href='style.css' rel='stylesheet' type='text/css' /></head><body><h1 id='markdown_syntax'>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><blockquote><p><a href='http://maruku.rubyforge.org/markdown_syntax.md'>This document in Markdown</a></p><p><a href='http://maruku.rubyforge.org/markdown_syntax.html'>This document in HTML</a></p><p><a href='http://maruku.rubyforge.org/markdown_syntax.pdf'>This document in PDF</a></p></blockquote><p>Table of contents: (<strong>auto-generated by Maruku!</strong>)</p><div class='maruku_toc'><ul style='list-style: none;'><li><span class='maruku_section_number'>1. </span><a href='#overview'>Overview</a><ul style='list-style: none;'><li><span class='maruku_section_number'>1.1. </span><a href='#philosophy'>Philosophy</a></li><li><span class='maruku_section_number'>1.2. </span><a href='#html'>Inline HTML</a></li><li><span class='maruku_section_number'>1.3. </span><a href='#autoescape'>Automatic Escaping for Special Characters</a></li></ul></li><li><span class='maruku_section_number'>2. </span><a href='#block'>Block Elements</a><ul style='list-style: none;'><li><span class='maruku_section_number'>2.1. </span><a href='#p'>Paragraphs and Line Breaks</a></li><li><span class='maruku_section_number'>2.2. </span><a href='#header'>Headers</a></li><li><span class='maruku_section_number'>2.3. </span><a href='#blockquote'>Blockquotes</a></li><li><span class='maruku_section_number'>2.4. </span><a href='#list'>Lists</a></li><li><span class='maruku_section_number'>2.5. </span><a href='#precode'>Code Blocks</a></li><li><span class='maruku_section_number'>2.6. </span><a href='#hr'>Horizontal Rules</a></li></ul></li><li><span class='maruku_section_number'>3. </span><a href='#span'>Span Elements</a><ul style='list-style: none;'><li><span class='maruku_section_number'>3.1. </span><a href='#link'>Links</a></li><li><span class='maruku_section_number'>3.2. </span><a href='#em'>Emphasis</a></li><li><span class='maruku_section_number'>3.3. </span><a href='#code'>Code</a></li><li><span class='maruku_section_number'>3.4. </span><a href='#img'>Images</a></li></ul></li><li><span class='maruku_section_number'>4. </span><a href='#misc'>Miscellaneous</a><ul style='list-style: none;'><li><span class='maruku_section_number'>4.1. </span><a href='#autolink'>Automatic Links</a></li><li><span class='maruku_section_number'>4.2. </span><a href='#backslash'>Backslash Escapes</a></li></ul></li></ul></div><hr /><h2 id='overview'><span class='maruku_section_number'>1. </span>Overview</h2><h3 id='philosophy'><span class='maruku_section_number'>1.1. </span>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'><span class='maruku_section_number'>1.2. </span>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'><span class='maruku_section_number'>1.3. </span>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'><span class='maruku_section_number'>2. </span>Block Elements</h2><h3 id='p'><span class='maruku_section_number'>2.1. </span>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'><span class='maruku_section_number'>2.2. </span>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'><span class='maruku_section_number'>2.3. </span>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'><span class='maruku_section_number'>2.4. </span>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'><span class='maruku_section_number'>2.5. </span>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'><span class='maruku_section_number'>2.6. </span>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 class='maruku_section_number'>3. </span>Span Elements</h2><h3 id='link'><span class='maruku_section_number'>3.1. </span>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;'>[Daring Fireball]: http://daringfireball.net/
194
+ </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
195
+ [Yahoo] [2] or [MSN] [3].
196
+
197
+ [1]: http://google.com/ &quot;Google&quot;
198
+ [2]: http://search.yahoo.com/ &quot;Yahoo Search&quot;
199
+ [3]: http://search.msn.com/ &quot;MSN Search&quot;
200
+ </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
201
+ [Yahoo][] or [MSN][].
202
+
203
+ [google]: http://google.com/ &quot;Google&quot;
204
+ [yahoo]: http://search.yahoo.com/ &quot;Yahoo Search&quot;
205
+ [msn]: http://search.msn.com/ &quot;MSN Search&quot;
206
+ </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;
207
+ title=&quot;Google&quot;&gt;Google&lt;/a&gt; than from
208
+ &lt;a href=&quot;http://search.yahoo.com/&quot; title=&quot;Yahoo Search&quot;&gt;Yahoo&lt;/a&gt;
209
+ or &lt;a href=&quot;http://search.msn.com/&quot; title=&quot;MSN Search&quot;&gt;MSN&lt;/a&gt;.&lt;/p&gt;
210
+ </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;)
211
+ than from [Yahoo](http://search.yahoo.com/ &quot;Yahoo Search&quot;) or
212
+ [MSN](http://search.msn.com/ &quot;MSN Search&quot;).
213
+ </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'><span class='maruku_section_number'>3.2. </span>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*
214
+
215
+ _single underscores_
216
+
217
+ **double asterisks**
218
+
219
+ __double underscores__
220
+ </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>
221
+
222
+ <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>
223
+
224
+ <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>
225
+
226
+ <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>
227
+ </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
228
+ </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\*
229
+
230
+
231
+ </pre><h3 id='code'><span class='maruku_section_number'>3.3. </span>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.
232
+ </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>
233
+ </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.`
234
+ </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.``
235
+ </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>
236
+ </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.
237
+ </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>
238
+ </pre><p>You can write this:</p><pre style='background-color: #f0f0e0;'>`&amp;#8212;` is the decimal-encoded equivalent of `&amp;mdash;`.
239
+ </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
240
+ 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>
241
+
242
+
243
+ </pre><h3 id='img'><span class='maruku_section_number'>3.4. </span>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)
244
+
245
+ ![Alt text](/path/to/img.jpg &quot;Optional title&quot;)
246
+ </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]
247
+ </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;
248
+ </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'><span class='maruku_section_number'>4. </span>Miscellaneous</h2><h3 id='autolink'><span class='maruku_section_number'>4.1. </span>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>
249
+ </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;
250
+ </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'>
251
+ </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'>
252
+ </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>
253
+ <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>
254
+ </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'><span class='maruku_section_number'>4.2. </span>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\*
255
+ </pre><p>Markdown provides backslash escapes for the following characters:</p><pre style='background-color: #f0f0e0;'>\ backslash
256
+ ` backtick
257
+ * asterisk
258
+ _ underscore
259
+ {} curly braces
260
+ [] square brackets
261
+ () parentheses
262
+ # hash mark
263
+ . dot
264
+ ! exclamation mark
265
+ </pre><div class='maruku_signature'><hr /><span style='font-size: small; font-style: italic'>Created by <a href='http://maruku.rubyforge.org' title='Maruku: a Markdown interpreter'>Maruku</a> at 17:00 on Friday, December 29th, 2006.</span></div></body></html>