maruku 0.2.13 → 0.3.0

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 (86) hide show
  1. data/bin/maruku +23 -15
  2. data/bin/maruku0.3 +37 -0
  3. data/bin/marutest +277 -0
  4. data/docs/changelog-0.3.html +99 -0
  5. data/docs/changelog-0.3.md +84 -0
  6. data/docs/faq.html +46 -0
  7. data/docs/faq.md +32 -0
  8. data/docs/index.html +629 -64
  9. data/docs/markdown_extra2.html +67 -14
  10. data/docs/markdown_syntax.html +631 -94
  11. data/docs/markdown_syntax_2.html +152 -0
  12. data/docs/maruku.html +629 -64
  13. data/docs/maruku.md +108 -105
  14. data/docs/proposal.html +362 -55
  15. data/docs/proposal.md +133 -169
  16. data/docs/todo.html +30 -0
  17. data/lib/maruku.rb +13 -3
  18. data/lib/maruku/errors_management.rb +75 -0
  19. data/lib/maruku/helpers.rb +164 -0
  20. data/lib/maruku/html_helper.rb +33 -13
  21. data/lib/maruku/parse_block.rb +89 -92
  22. data/lib/maruku/parse_doc.rb +43 -18
  23. data/lib/maruku/parse_span.rb +17 -46
  24. data/lib/maruku/parse_span_better.rb +681 -0
  25. data/lib/maruku/string_utils.rb +17 -10
  26. data/lib/maruku/structures.rb +62 -35
  27. data/lib/maruku/structures_iterators.rb +39 -0
  28. data/lib/maruku/tests/benchmark.rb +12 -4
  29. data/lib/maruku/tests/new_parser.rb +318 -0
  30. data/lib/maruku/to_html.rb +113 -44
  31. data/lib/maruku/to_latex.rb +32 -14
  32. data/lib/maruku/to_markdown.rb +110 -0
  33. data/lib/maruku/toc.rb +35 -1
  34. data/lib/maruku/version.rb +10 -1
  35. data/lib/test.rb +29 -0
  36. data/tests/others/escaping.md +6 -4
  37. data/tests/others/links.md +1 -1
  38. data/tests/others/lists_after_paragraph.md +44 -0
  39. data/tests/unittest/abbreviations.md +71 -0
  40. data/tests/unittest/blank.md +43 -0
  41. data/tests/unittest/blanks_in_code.md +131 -0
  42. data/tests/unittest/code.md +64 -0
  43. data/tests/unittest/code2.md +59 -0
  44. data/tests/unittest/code3.md +121 -0
  45. data/tests/unittest/easy.md +36 -0
  46. data/tests/unittest/email.md +39 -0
  47. data/tests/unittest/encoding/iso-8859-1.md +9 -0
  48. data/tests/unittest/encoding/utf-8.md +38 -0
  49. data/tests/unittest/entities.md +174 -0
  50. data/tests/unittest/escaping.md +97 -0
  51. data/tests/unittest/extra_dl.md +81 -0
  52. data/tests/unittest/extra_header_id.md +96 -0
  53. data/tests/unittest/extra_table1.md +78 -0
  54. data/tests/unittest/footnotes.md +120 -0
  55. data/tests/unittest/headers.md +64 -0
  56. data/tests/unittest/hrule.md +77 -0
  57. data/tests/unittest/images.md +114 -0
  58. data/tests/unittest/inline_html.md +185 -0
  59. data/tests/unittest/links.md +162 -0
  60. data/tests/unittest/list1.md +80 -0
  61. data/tests/unittest/list2.md +75 -0
  62. data/tests/unittest/list3.md +111 -0
  63. data/tests/unittest/list4.md +43 -0
  64. data/tests/unittest/lists.md +262 -0
  65. data/tests/unittest/lists_after_paragraph.md +280 -0
  66. data/tests/unittest/lists_ol.md +323 -0
  67. data/tests/unittest/misc_sw.md +751 -0
  68. data/tests/unittest/notyet/escape.md +46 -0
  69. data/tests/unittest/notyet/header_after_par.md +85 -0
  70. data/tests/unittest/notyet/ticks.md +67 -0
  71. data/tests/unittest/notyet/triggering.md +210 -0
  72. data/tests/unittest/one.md +33 -0
  73. data/tests/unittest/paragraph.md +34 -0
  74. data/tests/unittest/paragraph_rules/dont_merge_ref.md +60 -0
  75. data/tests/unittest/paragraph_rules/tab_is_blank.md +43 -0
  76. data/tests/unittest/paragraphs.md +84 -0
  77. data/tests/unittest/recover/recover_links.md +32 -0
  78. data/tests/unittest/references/long_example.md +87 -0
  79. data/tests/unittest/references/spaces_and_numbers.md +27 -0
  80. data/tests/unittest/syntax_hl.md +99 -0
  81. data/tests/unittest/test.md +36 -0
  82. data/tests/unittest/wrapping.md +88 -0
  83. data/tests/utf8-files/simple.md +1 -0
  84. metadata +139 -86
  85. data/lib/maruku/maruku.rb +0 -50
  86. data/tests/a.md +0 -10
@@ -0,0 +1,152 @@
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></head><head><title>Markdown: Syntax</title></head><body><h1 id='markdown_syntax'>Markdown: Syntax</h1><ul id='ProjectSubmenu'>
5
+ <li><a href='/projects/markdown/' title='Markdown Project Page'>Main</a></li>
6
+ <li><a href='/projects/markdown/basics' title='Markdown Basics'>Basics</a></li>
7
+ <li><a class='selected' title='Markdown Syntax Documentation'>Syntax</a></li>
8
+ <li><a href='/projects/markdown/license' title='Pricing and License Information'>License</a></li>
9
+ <li><a href='/projects/markdown/dingus' title='Online Markdown Web Form'>Dingus</a></li>
10
+ </ul><ul><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><p><strong>Note:</strong> This document is itself written using Markdown; you can <a href='/projects/markdown/syntax.text'>see the source for it by adding &apos;.text&apos; to the URL</a>.</p><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 style='background-color: #f0f0e0;'>This is a regular paragraph.
11
+ &lt;table&gt;
12
+ &lt;tr&gt;
13
+ &lt;td&gt;Foo&lt;/td&gt;
14
+ &lt;/tr&gt;
15
+ &lt;/table&gt;
16
+ This is another regular paragraph.</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</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</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 style='background-color: #f0f0e0;'>&amp;copy;</pre><p>and Markdown will leave it alone. But if you write:</p><pre style='background-color: #f0f0e0;'>AT&amp;T</pre><p>Markdown will translate it to:</p><pre style='background-color: #f0f0e0;'>AT&amp;amp;T</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</pre><p>Markdown will translate it to:</p><pre style='background-color: #f0f0e0;'>4 &amp;lt; 5</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 indented 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
17
+ =============
18
+ This is an H2
19
+ -------------</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
20
+ ## This is an H2
21
+ ###### This is an H6</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 #
22
+ ## This is an H2 ##
23
+ ### This is an H3 ######</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,
24
+ &gt; consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
25
+ &gt; Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
26
+ &gt;
27
+ &gt; Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
28
+ &gt; id sem consectetuer libero luctus adipiscing.</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,
29
+ consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
30
+ Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
31
+ &gt; Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
32
+ id sem consectetuer libero luctus adipiscing.</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.
33
+ &gt;
34
+ &gt; &gt; This is nested blockquote.
35
+ &gt;
36
+ &gt; Back to the first level.</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.
37
+ &gt;
38
+ &gt; 1. This is the first list item.
39
+ &gt; 2. This is the second list item.
40
+ &gt;
41
+ &gt; Here&apos;s some example code:
42
+ &gt;
43
+ &gt; return shell_exec(&quot;echo $input | $markdown_script&quot;);</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
44
+ * Green
45
+ * Blue</pre><p>is equivalent to:</p><pre style='background-color: #f0f0e0;'>+ Red
46
+ + Green
47
+ + Blue</pre><p>and:</p><pre style='background-color: #f0f0e0;'>- Red
48
+ - Green
49
+ - Blue</pre><p>Ordered lists use numbers followed by periods:</p><pre style='background-color: #f0f0e0;'>1. Bird
50
+ 2. McHale
51
+ 3. Parish</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 style='background-color: #f0f0e0;'>&lt;ol&gt;
52
+ &lt;li&gt;Bird&lt;/li&gt;
53
+ &lt;li&gt;McHale&lt;/li&gt;
54
+ &lt;li&gt;Parish&lt;/li&gt;
55
+ &lt;/ol&gt;</pre><p>If you instead wrote the list in Markdown like this:</p><pre style='background-color: #f0f0e0;'>1. Bird
56
+ 1. McHale
57
+ 1. Parish</pre><p>or even:</p><pre style='background-color: #f0f0e0;'>3. Bird
58
+ 1. McHale
59
+ 8. Parish</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.
60
+ Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
61
+ viverra nec, fringilla in, laoreet vitae, risus.
62
+ * Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
63
+ Suspendisse id sem consectetuer libero luctus adipiscing.</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.
64
+ Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
65
+ viverra nec, fringilla in, laoreet vitae, risus.
66
+ * Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
67
+ Suspendisse id sem consectetuer libero luctus adipiscing.</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
68
+ * Magic</pre><p>will turn into:</p><pre style='background-color: #f0f0e0;'>&lt;ul&gt;
69
+ &lt;li&gt;Bird&lt;/li&gt;
70
+ &lt;li&gt;Magic&lt;/li&gt;
71
+ &lt;/ul&gt;</pre><p>But this:</p><pre style='background-color: #f0f0e0;'>* Bird
72
+ * Magic</pre><p>will turn into:</p><pre style='background-color: #f0f0e0;'>&lt;ul&gt;
73
+ &lt;li&gt;&lt;p&gt;Bird&lt;/p&gt;&lt;/li&gt;
74
+ &lt;li&gt;&lt;p&gt;Magic&lt;/p&gt;&lt;/li&gt;
75
+ &lt;/ul&gt;</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
76
+ sit amet, consectetuer adipiscing elit. Aliquam hendrerit
77
+ mi posuere lectus.
78
+ Vestibulum enim wisi, viverra nec, fringilla in, laoreet
79
+ vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
80
+ sit amet velit.
81
+ 2. Suspendisse id sem consectetuer libero luctus adipiscing.</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.
82
+ This is the second paragraph in the list item. You&apos;re
83
+ only required to indent the first line. Lorem ipsum dolor
84
+ sit amet, consectetuer adipiscing elit.
85
+ * Another item in the same list.</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:
86
+ &gt; This is a blockquote
87
+ &gt; inside a list item.</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:
88
+ &lt;code goes here&gt;</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.</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.</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:
89
+ This is a code block.</pre><p>Markdown will generate:</p><pre style='background-color: #f0f0e0;'>&lt;p&gt;This is a normal paragraph:&lt;/p&gt;
90
+ &lt;pre&gt;&lt;code&gt;This is a code block.
91
+ &lt;/code&gt;&lt;/pre&gt;</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:
92
+ tell application &quot;Foo&quot;
93
+ beep
94
+ end tell</pre><p>will turn into:</p><pre style='background-color: #f0f0e0;'>&lt;p&gt;Here is an example of AppleScript:&lt;/p&gt;
95
+ &lt;pre&gt;&lt;code&gt;tell application &quot;Foo&quot;
96
+ beep
97
+ end tell
98
+ &lt;/code&gt;&lt;/pre&gt;</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;
99
+ &amp;copy; 2004 Foo Corporation
100
+ &lt;/div&gt;</pre><p>will turn into:</p><pre style='background-color: #f0f0e0;'>&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;footer&quot;&amp;gt;
101
+ &amp;amp;copy; 2004 Foo Corporation
102
+ &amp;lt;/div&amp;gt;
103
+ &lt;/code&gt;&lt;/pre&gt;</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, asterisks, or underscores 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;'>* * *
104
+ ***
105
+ *****
106
+ - - -
107
+ ---------------------------------------
108
+ _ _ _</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.
109
+ [This link](http://example.net/) has no title attribute.</pre><p>Will produce:</p><pre style='background-color: #f0f0e0;'>&lt;p&gt;This is &lt;a href=&quot;http://example.com/&quot; title=&quot;Title&quot;&gt;
110
+ an example&lt;/a&gt; inline link.&lt;/p&gt;
111
+ &lt;p&gt;&lt;a href=&quot;http://example.net/&quot;&gt;This link&lt;/a&gt; has no
112
+ title attribute.&lt;/p&gt;</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. </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.</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.</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;</pre><p>That is:</p><ul><li>Square brackets containing the link identifier (optionally indented from the left margin using up to three spaces);</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.</li></ul><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;</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
113
+ &quot;Optional Title Here&quot;</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]
114
+ [link text][A]</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][]</pre><p>And then define the link:</p><pre style='background-color: #f0f0e0;'>[Google]: http://google.com/</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.</pre><p>And then define the link:</p><pre style='background-color: #f0f0e0;'>
115
+ [Daring Fireball]: http://daringfireball.net/</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
116
+ [Yahoo] [2] or [MSN] [3].
117
+ [1]: http://google.com/ &quot;Google&quot;
118
+ [2]: http://search.yahoo.com/ &quot;Yahoo Search&quot;
119
+ [3]: http://search.msn.com/ &quot;MSN Search&quot;</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
120
+ [Yahoo][] or [MSN][].
121
+ [google]: http://google.com/ &quot;Google&quot;
122
+ [yahoo]: http://search.yahoo.com/ &quot;Yahoo Search&quot;
123
+ [msn]: http://search.msn.com/ &quot;MSN Search&quot;</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;
124
+ title=&quot;Google&quot;&gt;Google&lt;/a&gt; than from
125
+ &lt;a href=&quot;http://search.yahoo.com/&quot; title=&quot;Yahoo Search&quot;&gt;Yahoo&lt;/a&gt;
126
+ or &lt;a href=&quot;http://search.msn.com/&quot; title=&quot;MSN Search&quot;&gt;MSN&lt;/a&gt;.&lt;/p&gt;</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;)
127
+ than from [Yahoo](http://search.yahoo.com/ &quot;Yahoo Search&quot;) or
128
+ [MSN](http://search.msn.com/ &quot;MSN Search&quot;).</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*
129
+ _single underscores_
130
+ **double asterisks**
131
+ __double underscores__</pre><p>will produce:</p><pre style='background-color: #f0f0e0;'>&lt;em&gt;single asterisks&lt;/em&gt;
132
+ &lt;em&gt;single underscores&lt;/em&gt;
133
+ &lt;strong&gt;double asterisks&lt;/strong&gt;
134
+ &lt;strong&gt;double underscores&lt;/strong&gt;</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</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\*</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.</pre><p>will produce:</p><pre style='background-color: #f0f0e0;'>&lt;p&gt;Use the &lt;code&gt;printf()&lt;/code&gt; function.&lt;/p&gt;</pre><p>To include a literal backtick character within a code span, you can use multiple backticks as the opening and closing delimiters:</p><pre style='background-color: #f0f0e0;'>``There is a literal backtick (`) here.``</pre><p>which will produce this:</p><pre style='background-color: #f0f0e0;'>&lt;p&gt;&lt;code&gt;There is a literal backtick (`) here.&lt;/code&gt;&lt;/p&gt;</pre><p>The backtick delimiters surrounding a code span may include spaces -- one after the opening, one before the closing. This allows you to place literal backtick characters at the beginning or end of a code span:</p><pre style='background-color: #f0f0e0;'>A single backtick in a code span: `` ` ``
135
+ A backtick-delimited string in a code span: `` `foo` ``</pre><p>will produce:</p><pre style='background-color: #f0f0e0;'>&lt;p&gt;A single backtick in a code span: &lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
136
+ &lt;p&gt;A backtick-delimited string in a code span: &lt;code&gt;`foo`&lt;/code&gt;&lt;/p&gt;</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.</pre><p>into:</p><pre style='background-color: #f0f0e0;'>&lt;p&gt;Please don&apos;t use any &lt;code&gt;&amp;lt;blink&amp;gt;&lt;/code&gt; tags.&lt;/p&gt;</pre><p>You can write this:</p><pre style='background-color: #f0f0e0;'>`&amp;#8212;` is the decimal-encoded equivalent of `&amp;mdash;`.</pre><p>to produce:</p><pre style='background-color: #f0f0e0;'>&lt;p&gt;&lt;code&gt;&amp;amp;#8212;&lt;/code&gt; is the decimal-encoded
137
+ equivalent of &lt;code&gt;&amp;amp;mdash;&lt;/code&gt;.&lt;/p&gt;</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)
138
+ ![Alt text](/path/to/img.jpg &quot;Optional title&quot;)</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]</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;</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 style='background-color: #f0f0e0;'>&lt;a href=&quot;http://example.com/&quot;&gt;http://example.com/&lt;/a&gt;</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;</pre><p>into something like this:</p><pre style='background-color: #f0f0e0;'>&lt;a href=&quot;&amp;#x6D;&amp;#x61;i&amp;#x6C;&amp;#x74;&amp;#x6F;:&amp;#x61;&amp;#x64;&amp;#x64;&amp;#x72;&amp;#x65;
139
+ &amp;#115;&amp;#115;&amp;#64;&amp;#101;&amp;#120;&amp;#x61;&amp;#109;&amp;#x70;&amp;#x6C;e&amp;#x2E;&amp;#99;&amp;#111;
140
+ &amp;#109;&quot;&gt;&amp;#x61;&amp;#x64;&amp;#x64;&amp;#x72;&amp;#x65;&amp;#115;&amp;#115;&amp;#64;&amp;#101;&amp;#120;&amp;#x61;
141
+ &amp;#109;&amp;#x70;&amp;#x6C;e&amp;#x2E;&amp;#99;&amp;#111;&amp;#109;&lt;/a&gt;</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\*</pre><p>Markdown provides backslash escapes for the following characters:</p><pre style='background-color: #f0f0e0;'>\ backslash
142
+ ` backtick
143
+ * asterisk
144
+ _ underscore
145
+ {} curly braces
146
+ [] square brackets
147
+ () parentheses
148
+ # hash mark
149
+ + plus sign
150
+ - minus sign (hyphen)
151
+ . dot
152
+ ! exclamation mark</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 14:55 on Sunday, December 31st, 2006.</span></div></body></html>
@@ -1,118 +1,683 @@
1
- <?xml version='1.0' ?>
1
+ <?xml version='1.0' encoding='utf-8'?>
2
2
  <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
3
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>
4
+ <html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
5
+ <head>
6
+ <title>Maruku: a Markdown-superset interpreter</title>
7
+
8
+ <link href='style.css' rel='stylesheet' type='text/css' />
9
+ </head>
10
+ <body>
11
+ <h1 id='maruku_a_markdownsuperset_interpreter'>Mar<strong>u</strong>k<strong>u</strong>: a Markdown-superset interpreter</h1>
12
+
13
+ <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>
14
+
15
+ <p>Maruku allows you to write in an easy-to-read-and-write syntax, like this:</p>
16
+
17
+ <blockquote>
18
+ <p><a href='http://maruku.rubyforge.org/maruku.md'>This document in Markdown</a> </p>
19
+ </blockquote>
20
+
21
+ <p>Then it can be translated to HTML:</p>
22
+
23
+ <blockquote>
24
+ <p><a href='http://maruku.rubyforge.org/maruku.html'>This document in HTML</a></p>
25
+ </blockquote>
26
+
27
+ <p>or LaTeX, which is then converted to PDF:</p>
28
+
29
+ <blockquote>
30
+ <p><a href='http://maruku.rubyforge.org/maruku.pdf'>This document in PDF</a></p>
31
+ </blockquote>
32
+
33
+ <p>Maruku implements:</p>
34
+
35
+ <ul>
36
+ <li>
37
+ <p>the original <a href='http://maruku.rubyforge.org/markdown_syntax.html'>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>
38
+ </li>
39
+
40
+ <li>
41
+ <p>all the improvements in <a href='http://www.michelf.com/projects/php-markdown/extra/'>PHP Markdown Extra</a>. </p>
42
+ </li>
43
+
44
+ <li>
45
+ <p>a new <a href='#meta'>meta-data syntax</a></p>
46
+ </li>
47
+ </ul>
48
+
49
+ <p><strong>Authors</strong>: Maruku has been developed so far by <a href='http://www.dis.uniroma1.it/~acensi/'>Andrea Censi</a>. Contributors are most welcome!</p>
50
+
51
+ <p><strong>The name of the game</strong>: Maruku is the <a href='http://en.wikipedia.org/wiki/Romaji'>romaji</a> translitteration of the <a href='http://en.wikipedia.org/wiki/Katakana'>katakana</a> translitteration of &quot;Mark&quot;, the first word in Markdown. I chose this name because Ruby is Japanese, and also the sillable &quot;ru&quot; appears in Maruku.</p>
52
+
53
+ <hr />
54
+
55
+ <p>Table of contents: (<strong>auto-generated by Maruku!</strong>)</p>
56
+
57
+ <div class='maruku_toc'>
58
+ <ul style='list-style: none;'>
59
+ <li><span class='maruku_section_number'>1. </span><a href='#release_notes'>Release notes - version 0.3.0 (January 3rd, 2007)</a></li>
60
+
61
+ <li><span class='maruku_section_number'>2. </span><a href='#download'>Download</a>
62
+ <ul style='list-style: none;'>
63
+ <li><span class='maruku_section_number'>2.1. </span><a href='#bugs_report'>Bugs report</a></li>
64
+ </ul>
65
+ </li>
66
+
67
+ <li><span class='maruku_section_number'>3. </span><a href='#usage'>Usage</a>
68
+ <ul style='list-style: none;'>
69
+ <li><span class='maruku_section_number'>3.1. </span><a href='#from_the_command_line'>From the command line</a></li>
70
+ </ul>
71
+ </li>
72
+
73
+ <li><span class='maruku_section_number'>4. </span><a href='#extra'>Examples of PHP Markdown Extra syntax</a></li>
74
+
75
+ <li><span class='maruku_section_number'>5. </span><a href='#maruku-and-bluecloth'>Maruku and Bluecloth</a></li>
76
+
77
+ <li><span class='maruku_section_number'>6. </span><a href='#meta'>New meta-data syntax</a>
78
+ <ul style='list-style: none;'>
79
+ <li><span class='maruku_section_number'>6.1. </span><a href='#metadata_for_the_document'>Meta-data for the document</a></li>
80
+
81
+ <li><span class='maruku_section_number'>6.2. </span><a href='#metadata_for_elements'>Meta-data for elements</a></li>
82
+
83
+ <li><span class='maruku_section_number'>6.3. </span><a href='#shortcuts'>Shortcuts</a></li>
84
+
85
+ <li><span class='maruku_section_number'>6.4. </span><a href='#metalist'>List of meta-data</a></li>
86
+
87
+ <li><span class='maruku_section_number'>6.5. </span><a href='#examples'>Examples</a></li>
88
+ </ul>
89
+ </li>
90
+
91
+ <li><span class='maruku_section_number'>7. </span><a href='#features'>Other Features</a>
92
+ <ul style='list-style: none;'>
93
+ <li><span class='maruku_section_number'>7.1. </span><a href='#automatic_generation_of_the_table_of_contents'>Automatic generation of the table of contents</a></li>
94
+
95
+ <li><span class='maruku_section_number'>7.2. </span><a href='#this_header_contains_emphasis_strong_text_and_'>This header contains <em>emphasis</em> <strong>strong text</strong> and <code>code</code></a></li>
96
+
97
+ <li><span class='maruku_section_number'>7.3. </span><a href='#use_html_entities'>Use HTML entities</a></li>
98
+ </ul>
99
+ </li>
100
+
101
+ <li><span class='maruku_section_number'>8. </span><a href='#future'>Future developments</a>
102
+ <ul style='list-style: none;'>
103
+ <li><span class='maruku_section_number'>8.1. </span><a href='#a_syntax_for_adding_math'>A syntax for adding math</a></li>
104
+ </ul>
105
+ </li>
106
+ </ul>
107
+ </div>
108
+
109
+ <hr />
110
+
111
+ <h2 id='release_notes'><span class='maruku_section_number'>1. </span>Release notes - version 0.3.0 (January 3rd, 2007)</h2>
112
+
113
+ <p>Note: Maruku seems to be very robust, nevertheless it is still beta-level software. So if you want to use it in production environments, please check back in a month or so, while we squash the remaining bugs.</p>
114
+
115
+ <p>In the meantime, feel free to toy around, and please signal problems, request features, by <a href='http://www.dis.uniroma1.it/~acensi/contact.html'>contacting me</a> or using the <a href='http://rubyforge.org/tracker/?group_id=2795'>tracker</a>. For issues about the Markdown syntax itself and improvements to it, please write to the <a href='http://six.pairlist.net/mailman/listinfo/markdown-discuss'>Markdown-discuss mailing list</a>.</p>
116
+
117
+ <p>Have fun!</p>
118
+
119
+ <p>Changes in 0.3.0:</p>
120
+
121
+ <ul>
122
+ <li>
123
+ <p>A real parser is used instead of a regexp-based system, also for span-level elements.</p>
124
+
125
+ <p>Now Maruku is almost 2x faster than Bluecloth, while having more features.</p>
126
+
127
+ <p>Here are some benchmarks:</p>
128
+
129
+ <pre><code>BlueCloth (to_html): parsing 0.00 sec + rendering 1.54 sec = 1.55 sec
130
+ Maruku (to_html): parsing 0.47 sec + rendering 0.38 sec = 0.85 sec
131
+ Maruku (to_latex): parsing 0.49 sec + rendering 0.25 sec = 0.73 sec</code></pre>
132
+
133
+ <p>This is the result of running <code>lib/maruku/tests/benchmark.rb</code> on the Markdown specification.</p>
134
+ </li>
135
+
136
+ <li>
137
+ <p>Prettier HTML output by adding whitespace.</p>
138
+ </li>
139
+
140
+ <li>
141
+ <p>Added a full suite of unit-tests for the span-level parser.</p>
142
+ </li>
143
+
144
+ <li>
145
+ <p>Error management: Having a real parser, Maruku warns you about syntax issues.</p>
146
+
147
+ <p>The default action is to warn and try to continue. If you do this:</p>
148
+
149
+ <pre><code>Maruku.new(string, {:on_error =&gt; :raise})
150
+ </code></pre>
151
+
152
+ <p>then syntax errors will cause an exception to be raised (you can catch this and retry).</p>
153
+ </li>
154
+
155
+ <li>
156
+ <p>Fixed a series of bugs in handling inline HTML code.</p>
157
+ </li>
158
+ </ul>
159
+
160
+ <p>Immediate TODO-list:</p>
161
+
162
+ <ul>
163
+ <li>
164
+ <p>UTF-8 input/output works OK for HTML, however I am having pain trying to export to LaTeX. I want at least Japanese characters support, so if you know how to do this you are very welcome to give me an hand.</p>
165
+
166
+ <p>For example: in the HTML version, you should see accented characters in this parenthesis: </p>
167
+
168
+ <blockquote>
169
+ <p>(àèìòù)</p>
170
+ </blockquote>
171
+
172
+ <p>and Japanese text in these other parentheses: </p>
173
+
174
+ <blockquote>
175
+ <p>(カタカナで 私の 名前は アンドレア チェンシ です).</p>
176
+
177
+ <p>(日本のガルは 大好き、でも、日本語は難しですから、そうぞ 英語話すガルを おしえてください).</p>
178
+ </blockquote>
179
+
180
+ <p>In the LaTeX version, these do not appear. I know how to do LaTeX with ISO-8859-1 encoding (European characters), but I&apos;m struggling with half-baked solutions for UTF-8 encoded documents.</p>
181
+ </li>
182
+
183
+ <li>
184
+ <p>Implement the <a href='http://maruku.rubyforge.org/proposal.html'>new meta-data proposal</a>.</p>
185
+ </li>
186
+
187
+ <li>
188
+ <p>Exporting to Markdown (pretty printing).</p>
189
+ </li>
190
+
191
+ <li>
192
+ <p>Exporting to HTML splitting in multiple files.</p>
193
+ </li>
194
+
195
+ <li>
196
+ <p>RubyPants.</p>
197
+ </li>
198
+
199
+ <li>
200
+ <p>Support for images in PDF.</p>
201
+ </li>
202
+ </ul>
203
+
204
+ <h2 id='download'><span class='maruku_section_number'>2. </span>Download</h2>
205
+
206
+ <p>The development site is <a href='http://rubyforge.org/projects/maruku/'>http://rubyforge.org/projects/maruku/</a>.</p>
207
+
208
+ <p>Install with:</p>
209
+
210
+ <pre><code>$ gem install maruku
211
+ </code></pre>
212
+
213
+ <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>
214
+
215
+ <p>Anonymous access to the repository is possible with:</p>
216
+
217
+ <pre><code>$ svn checkout svn://rubyforge.org/var/svn/maruku
218
+ </code></pre>
219
+
220
+ <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>
221
+
222
+ <h3 id='bugs_report'><span class='maruku_section_number'>2.1. </span>Bugs report</h3>
223
+
224
+ <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>
225
+
226
+ <h2 id='usage'><span class='maruku_section_number'>3. </span>Usage</h2>
227
+
228
+ <p>This is the basic usage:</p>
229
+
230
+ <pre class='ruby'><span class='ident'>require</span> <span class='punct'>'</span><span class='string'>rubygems</span><span class='punct'>'</span>
7
231
  <span class='ident'>require</span> <span class='punct'>'</span><span class='string'>maruku</span><span class='punct'>'</span>
8
232
 
9
233
  <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|
234
+ <span class='ident'>puts</span> <span class='ident'>doc</span><span class='punct'>.</span><span class='ident'>to_html</span></pre>
235
+
236
+ <p>The method <code>to_html</code> outputs only an HTML fragment, while the method <code>to_html_document</code> outputs a complete XHTML 1.0 document:</p>
237
+
238
+ <pre class='ruby'><span class='ident'>puts</span> <span class='ident'>doc</span><span class='punct'>.</span><span class='ident'>to_html_document</span></pre>
239
+
240
+ <p>You can have the REXML document tree with:</p>
241
+
242
+ <pre class='ruby'><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></pre>
243
+
244
+ <h3 id='from_the_command_line'><span class='maruku_section_number'>3.1. </span>From the command line</h3>
245
+
246
+ <p>There are two command-line programs installed: <code>maruku</code> and <code>marutex</code>.</p>
247
+
248
+ <ul>
249
+ <li>
250
+ <p><code>maruku</code> converts Markdown to HTML:</p>
251
+
252
+ <pre><code>$ maruku file.md # creates file.html</code></pre>
253
+ </li>
254
+
255
+ <li>
256
+ <p><code>marutex</code> converts Markdown to LaTeX, then calls <code>pdflatex</code> to transform to PDF</p>
257
+
258
+ <pre><code>$ marutex file.md # creates file.tex and file.pdf</code></pre>
259
+ </li>
260
+ </ul>
261
+
262
+ <h2 id='extra'><span class='maruku_section_number'>4. </span>Examples of PHP Markdown Extra syntax</h2>
263
+
264
+ <ul>
265
+ <li>
266
+ <p>tables</p>
267
+
268
+ <pre><code>Col1 | Very very long head | Very very long head|
13
269
  -----|:-------------------:|-------------------:|
14
270
  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]
271
+ </code></pre>
272
+
273
+ <table class='example'>
274
+ <thead>
275
+ <tr><th>Col1</th><th>Very very long head</th><th>Very very long head</th></tr>
276
+ </thead>
277
+ <tbody>
278
+ <tr>
279
+ <td style='text-align: left;'>cell</td>
280
+
281
+ <td style='text-align: center;'>center-align</td>
282
+
283
+ <td style='text-align: right;'>right-align</td>
284
+ </tr>
285
+ </tbody></table>
286
+ </li>
287
+
288
+ <li>
289
+ <p>footnotes <sup id='fnref:1'><a href='#fn:1' rel='footnote'>1</a></sup></p>
290
+
291
+ <pre><code>* footnotes [^foot]
292
+
293
+ [^foot]: I really was missing those.</code></pre>
294
+ </li>
295
+
296
+ <li>
297
+ <p>Markdown inside HTML elememnts</p>
298
+ </li>
299
+ </ul>
16
300
 
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>
301
+ <pre class='xml'><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
302
  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
303
+ <span class='punct'>&lt;/</span><span class='tag'>div</span><span class='punct'>&gt;</span></pre>
304
+
305
+ <div style='border: solid 1px black'>
306
+ <p>This is a div with Markdown <strong>strong text</strong></p>
307
+ </div>
308
+
309
+ <ul>
310
+ <li>
311
+ <p>header ids</p>
312
+
313
+ <pre><code>## Download ## {#download}
314
+ </code></pre>
315
+
316
+ <p>For example, <a href='#download'>a link to the download</a> header.</p>
317
+
318
+ <p>Note that you can use also the new <a href='#meta'>meta-data syntax</a> for the same purpose:</p>
319
+
320
+ <pre><code>@ id: download
321
+ ## Header ## </code></pre>
322
+ </li>
323
+
324
+ <li>
325
+ <p>definition lists</p>
326
+
327
+ <pre><code>Definition list
22
328
  : 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
329
+ </code></pre>
330
+
331
+ <dl>
332
+ <dt>Definition list</dt>
333
+
334
+ <dd>something very hard to parse</dd>
335
+ </dl>
336
+ </li>
337
+
338
+ <li>
339
+ <p>abbreviations or <abbr title='Simply an abbreviation'>ABB</abbr> for short.</p>
340
+ </li>
341
+ </ul>
342
+
343
+ <h2 id='maruku-and-bluecloth'><span class='maruku_section_number'>5. </span>Maruku and Bluecloth</h2>
344
+
345
+ <p>The other Ruby implementation of Markdown is <a href='http://www.deveiate.org/projects/BlueCloth'>Bluecloth</a>. </p>
346
+
347
+ <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 <code>gsub</code> to transform to HTML.</p>
348
+
349
+ <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>
350
+
351
+ <p>Other improvements over Bluecloth:</p>
352
+
353
+ <ul>
354
+ <li>
355
+ <p>the HTML output is provided also as a <code>REXML</code> document tree.</p>
356
+ </li>
357
+
358
+ <li>
359
+ <p>PHP Markdown Syntax support.</p>
360
+ </li>
361
+ </ul>
362
+
363
+ <h2 id='meta'><span class='maruku_section_number'>6. </span>New meta-data syntax</h2>
364
+
365
+ <p>Maruku implements a syntax that allows to attach &quot;meta&quot; information to objects.</p>
366
+
367
+ <h3 id='metadata_for_the_document'><span class='maruku_section_number'>6.1. </span>Meta-data for the document</h3>
368
+
369
+ <p>Meta-data for the document itself is specified through the use of email headers:</p>
370
+
371
+ <pre><code>Title: A simple document containing meta-headers
24
372
  CSS: style.css
25
373
 
26
374
  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.
375
+ </code></pre>
376
+
377
+ <p>When creating the document through </p>
378
+
379
+ <pre class='ruby'><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></pre>
380
+
381
+ <p>the title and stylesheet are added as expected.</p>
382
+
383
+ <p>Meta-data keys are assumed to be case-insensitive.</p>
384
+
385
+ <h3 id='metadata_for_elements'><span class='maruku_section_number'>6.2. </span>Meta-data for elements</h3>
386
+
387
+ <p>Maruku introduces a new syntax for attaching metadata to paragraphs, tables, and so on.</p>
388
+
389
+ <p>For example, consider the creation of two paragraphs:</p>
390
+
391
+ <pre><code>Paragraph 1 is a warning.
29
392
 
30
393
  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
394
+ </code></pre>
395
+
396
+ <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>
397
+
398
+ <pre><code>@ class: warning
32
399
  Paragraph 1 is a warning
33
400
 
34
401
  Paragraph 2
35
402
 
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
403
+ </code></pre>
404
+
405
+ <p>You can add more by separating with a <code>;</code>:</p>
406
+
407
+ <pre><code>@ class: warning; id: warning1
37
408
  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
409
+ </code></pre>
410
+
411
+ <p>A meta-data declaration is composed of </p>
412
+
413
+ <ol>
414
+ <li>newline</li>
415
+
416
+ <li>an at-symbol <code>@</code></li>
417
+
418
+ <li>a series of name-value pairs. Each name-value is separated by a colon <code>:</code>, pairs are separated by semi-colons <code>;</code> </li>
419
+ </ol>
420
+
421
+ <p>Many declaration can be used, and they refer to <em>the following</em> object:</p>
422
+
423
+ <pre><code>@ class: warning
39
424
  @ id: warning1
40
425
  Paragraph 1 is a warning
41
- </pre><p>These can also be separated by newlines:</p><pre style='background-color: #f0f0e0;'>@ class: warning
426
+ </code></pre>
427
+
428
+ <p>These can also be separated by newlines:</p>
429
+
430
+ <pre><code>@ class: warning
42
431
 
43
432
  @ id: warning1
44
433
 
45
434
  Paragraph 1 is a warning
46
435
 
47
- </pre><h3 id='shortcuts'><span class='maruku_section_number'>5.3. </span>Shortcuts</h3><p>This:</p><pre style='background-color: #f0f0e0;'>@ .xyz
436
+ </code></pre>
437
+
438
+ <h3 id='shortcuts'><span class='maruku_section_number'>6.3. </span>Shortcuts</h3>
439
+
440
+ <p>This:</p>
441
+
442
+ <pre><code>@ .xyz
48
443
  Paragraph
49
- </pre><p>is equivalent to:</p><pre style='background-color: #f0f0e0;'>@ class: xyz
444
+ </code></pre>
445
+
446
+ <p>is equivalent to:</p>
447
+
448
+ <pre><code>@ class: xyz
50
449
  Paragraph
51
- </pre><p>This:</p><pre style='background-color: #f0f0e0;'>@ #xyz
450
+ </code></pre>
451
+
452
+ <p>This:</p>
453
+
454
+ <pre><code>@ #xyz
52
455
  Paragraph
53
- </pre><p>is equivalent to:</p><pre style='background-color: #f0f0e0;'>@ id: xyz
456
+ </code></pre>
457
+
458
+ <p>is equivalent to:</p>
459
+
460
+ <pre><code>@ id: xyz
54
461
  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
462
+ </code></pre>
463
+
464
+ <p>Also, if the value is not present, it defaults to <code>true</code>:</p>
465
+
466
+ <pre><code>@ test
56
467
 
57
468
  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
469
+ </code></pre>
470
+
471
+ <hr />
472
+
473
+ <h3 id='metalist'><span class='maruku_section_number'>6.4. </span>List of meta-data</h3>
474
+
475
+ <dl>
476
+ <dt><strong><code>title</code>, <code>subject</code></strong></dt>
477
+
478
+ <dd>
479
+ <p>(document) Sets the title of the document (HTML: used in the <code>TITLE</code> element).</p>
480
+ </dd>
481
+
482
+ <dt><strong><code>use_numbered_headers</code></strong></dt>
483
+
484
+ <dd>
485
+ <p>(document) If <code>true</code>, headers are numbered (just like this document). Default is <code>false</code>.</p>
486
+ </dd>
487
+
488
+ <dt><strong><code>css</code></strong></dt>
489
+
490
+ <dd>
491
+ <p>(document, HTML) Url of stylesheet.</p>
492
+ </dd>
493
+
494
+ <dt><strong><code>html_use_syntax</code></strong></dt>
495
+
496
+ <dd>
497
+ <p>(document, HTML) If set, use the <a href='http://syntax.rubyforge.org/'>Ruby <code>syntax</code> library</a> to add source highlighting.</p>
498
+ </dd>
499
+
500
+ <dt><strong><code>latex_use_listings</code></strong></dt>
501
+
502
+ <dd>
503
+ <p>(document, LaTeX) If set, use the fancy <a href='http://www.ctan.org/tex-archive/macros/latex/contrib/listings/'><code>listings</code> package</a> for better displaying code blocks.</p>
504
+
505
+ <p> If not set, use standard <code>verbatim</code> environment.</p>
506
+ </dd>
507
+
508
+ <dt><strong><code>style</code>, <code>id</code>, <code>class</code></strong></dt>
509
+
510
+ <dd>
511
+ <p>(any block object, HTML) Standard CSS attributes are copied.</p>
512
+ </dd>
513
+
514
+ <dt><strong><code>lang</code></strong></dt>
515
+
516
+ <dd>
517
+ <p>(code blocks) Name of programming language (<code>ruby</code>) for syntax highlighting.</p>
518
+
519
+ <p> Default for this is <code>code_lang</code> in document.</p>
520
+
521
+ <p> Syntax highlighting is delegated to the <a href='http://syntax.rubyforge.org/'><code>syntax</code> library</a> for HTML output and to the <a href='http://www.ctan.org/tex-archive/macros/latex/contrib/listings/'><code>listings</code> package</a> for LaTeX output.</p>
522
+ </dd>
523
+
524
+ <dt><strong><code>code_show_spaces</code></strong></dt>
525
+
526
+ <dd>
527
+ <p>Shows tabs and newlines (default is read in the document object).</p>
528
+ </dd>
529
+
530
+ <dt><strong><code>code_background_color</code></strong></dt>
531
+
532
+ <dd>
533
+ <p>Background color for code blocks. (default is read in the document object).</p>
534
+
535
+ <p>The format is either a named color (<code>green</code>, <code>red</code>) or a CSS color of the form <code>#ff00ff</code>. </p>
536
+
537
+ <ul>
538
+ <li>
539
+ <p>for <strong>HTML output</strong>, the value is put straight in the <code>background-color</code> CSS property of the block.</p>
540
+ </li>
541
+
542
+ <li>
543
+ <p>for <strong>LaTeX output</strong>, if it is a named color, it must be a color accepted by the LaTeX <code>color</code> packages. If it is of the form <code>#ff00ff</code>, Maruku defines a color using the <code>\color[rgb]{r,g,b}</code> macro. </p>
544
+
545
+ <p>For example, for <code>#0000ff</code>, the macro is called as: <code>\color[rgb]{0,0,1}</code>.</p>
546
+ </li>
547
+ </ul>
548
+ </dd>
549
+ </dl>
550
+
551
+ <h3 id='examples'><span class='maruku_section_number'>6.5. </span>Examples</h3>
552
+
553
+ <p>An example of this is the following:</p>
554
+
555
+ <pre><code>@&not;code_show_spaces;&not;code_background_color:&not;green
59
556
 
60
557
  &raquo;&nbsp;&nbsp;&nbsp;&not;One&not;space
61
558
  &raquo;&nbsp;&nbsp;&nbsp;&not;&not;Two&not;spaces
62
559
  &raquo;&nbsp;&nbsp;&nbsp;&raquo;&nbsp;&nbsp;&nbsp;&not;&raquo;&nbsp;&nbsp;&nbsp;Tab,&not;space,&not;tab
63
560
  &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
561
+ </code></pre>
562
+
563
+ <p>That will produce:</p>
564
+
565
+ <pre style='background-color: green;'><code>&not;One&not;space
65
566
  &not;&not;Two&not;spaces
66
567
  &raquo;&nbsp;&nbsp;&nbsp;&not;&raquo;&nbsp;&nbsp;&nbsp;Tab,&not;space,&not;tab
67
568
  &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
569
+ </code></pre>
570
+
571
+ <p>Example with css-style color:</p>
572
+
573
+ <pre><code>@ code_background_color: #455678
69
574
 
70
575
  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
576
+ </code></pre>
577
+
578
+ <p>produces:</p>
579
+
580
+ <pre style='background-color: #455678;'><code>A strange color
581
+ </code></pre>
582
+
583
+ <p>Or highlighting (does not work well yet):</p>
584
+
585
+ <pre><code>@ lang: xml
73
586
  &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>
587
+ </code></pre>
588
+
589
+ <p>produces:</p>
590
+
591
+ <pre class='xml'><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></pre>
75
592
 
593
+ <hr />
76
594
 
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
595
+ <h2 id='features'><span class='maruku_section_number'>7. </span>Other Features</h2>
596
+
597
+ <h3 id='automatic_generation_of_the_table_of_contents'><span class='maruku_section_number'>7.1. </span>Automatic generation of the table of contents</h3>
598
+
599
+ <p>If you create a list, and then set the <code>toc</code> attribute, when rendering Maruku will create an auto-generated table of contents.</p>
600
+
601
+ <pre><code>@ toc
78
602
  * 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$
603
+ </code></pre>
604
+
605
+ <p>You can see an example of this at the beginning of this document.</p>
606
+
607
+ <h3 id='this_header_contains_emphasis_strong_text_and_'><span class='maruku_section_number'>7.2. </span>This header contains <em>emphasis</em> <strong>strong text</strong> and <code>code</code></h3>
608
+
609
+ <p>Note that this header contains formatting and it still works, also in the table of contents.</p>
610
+
611
+ <p>And <a href='#features'>This is a <em>link</em> with <strong>all</strong> <strong><em>sort</em></strong> of <code>weird stuff</code></a> in the text.</p>
612
+
613
+ <h3 id='use_html_entities'><span class='maruku_section_number'>7.3. </span>Use HTML entities</h3>
614
+
615
+ <p>If you want to use HTML entities, go on! We will take care of the translation to LaTeX:</p>
616
+
617
+ <table>
618
+ <thead>
619
+ <tr><th>Entity</th><th>Result</th></tr>
620
+ </thead>
621
+ <tbody>
622
+ <tr>
623
+ <td style='text-align: left;'><code>&amp;copy;</code></td>
624
+
625
+ <td style='text-align: left;'>&copy;</td>
626
+ </tr>
627
+
628
+ <tr>
629
+ <td style='text-align: left;'><code>&amp;pound;</code></td>
630
+
631
+ <td style='text-align: left;'>&pound;</td>
632
+ </tr>
633
+
634
+ <tr>
635
+ <td style='text-align: left;'><code>a&amp;nbsp;b</code></td>
636
+
637
+ <td style='text-align: left;'>a&nbsp;b</td>
638
+ </tr>
639
+
640
+ <tr>
641
+ <td style='text-align: left;'><code>&amp;lambda;</code></td>
642
+
643
+ <td style='text-align: left;'>&lambda;</td>
644
+ </tr>
645
+
646
+ <tr>
647
+ <td style='text-align: left;'><code>&amp;mdash;</code></td>
648
+
649
+ <td style='text-align: left;'>&mdash;</td>
650
+ </tr>
651
+ </tbody></table>
652
+
653
+ <h2 id='future'><span class='maruku_section_number'>8. </span>Future developments</h2>
654
+
655
+ <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>
656
+
657
+ <h3 id='a_syntax_for_adding_math'><span class='maruku_section_number'>8.1. </span>A syntax for adding math</h3>
658
+
659
+ <p>Something inspired from LaTeX should be familiar to all:</p>
660
+
661
+ <pre><code>This is inline math: $\alpha$
110
662
 
111
663
 
112
664
  This is an equation with label:
113
665
 
114
666
  $ \alpha = \beta + \gamma $ (eq:1)
115
667
 
116
- This is a reference to equation: please see (eq:1)
668
+ This is a reference to equation: please see (eq:1)</code></pre>
669
+
670
+ <div class='footnotes'>
671
+ <hr />
672
+
673
+ <ol>
674
+ <li id='fn:1'>
675
+ <p>I really was missing those.<a href='#fnref:1' rev='footnote'>&#8617;</a></p>
676
+ </li>
677
+ </ol>
678
+ </div>
117
679
 
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>
680
+ <div class='maruku_signature'>
681
+ <hr />
682
+ <span style='font-size: small; font-style: italic'>Created by <a href='http://maruku.rubyforge.org' title='Maruku: a Markdown interpreter'>Maruku</a> at 00:33 on Wednesday, January 03rd, 2007.</span></div>
683
+ </body></html>