maruku 0.2.13 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
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,84 @@
1
+ css: style.css
2
+
3
+ Release notes - version 0.3.0 (January 3rd, 2007)
4
+ -------------------------------------------------
5
+
6
+ Note: Maruku seems to be very robust, nevertheless it is still beta-level
7
+ software. So if you want to use it in production environments, please
8
+ check back in a month or so, while we squash the remaining bugs.
9
+
10
+ In the meantime, feel free to toy around, and please signal problems,
11
+ request features, by [contacting me][contact] or using the [tracker][tracker].
12
+ For issues about the Markdown syntax itself and improvements to it,
13
+ please write to the [Markdown-discuss mailing list][markdown-discuss].
14
+
15
+ Have fun!
16
+
17
+ Changes in 0.3.0:
18
+
19
+ * A real parser is used instead of a regexp-based system, also for span-level
20
+ elements..
21
+
22
+ Now Maruku is almost 2x faster than Bluecloth, while having more features.
23
+
24
+ Here are some benchmarks:
25
+
26
+ BlueCloth (to_html): parsing 0.00 sec + rendering 1.54 sec = 1.55 sec
27
+ Maruku (to_html): parsing 0.47 sec + rendering 0.38 sec = 0.85 sec
28
+ Maruku (to_latex): parsing 0.49 sec + rendering 0.25 sec = 0.73 sec
29
+
30
+ This is the result of running `lib/maruku/tests/benchmark.rb` on the Markdown
31
+ specification.
32
+
33
+ * Prettier HTML output by adding whitespace.
34
+
35
+ * Added a full suite of unit-tests for the span-level parser.
36
+
37
+ * Error management: Having a real parser, Maruku warns you about syntax issues.
38
+
39
+ The default action is to warn and try to continue. If you do this:
40
+
41
+ Maruku.new(string, {:on_error => :raise})
42
+
43
+ then syntax errors will cause an exception to be raised (you can catch this
44
+ and retry).
45
+
46
+ * Fixed a series of bugs in handling inline HTML code.
47
+
48
+ Immediate TODO-list:
49
+
50
+ * UTF-8 input/output works OK for HTML, however I am having pain trying to export
51
+ to LaTeX. I want at least Japanese characters support, so if you know how to
52
+ do this you are very welcome to give me an hand.
53
+
54
+ For example: in the HTML version, you should see accented characters in this
55
+ parenthesis:
56
+
57
+ > (àèìòù)
58
+
59
+ and Japanese text in these other parentheses:
60
+
61
+ > (カタカナで 私の 名前は アンドレア チェンシ です).
62
+ >
63
+ > (日本のガルは 大好き、でも、日本語は難しですから、そうぞ 英語話すガルを おしえてください).
64
+
65
+ In the LaTeX version, these do not appear. I know how to do LaTeX with
66
+ ISO-8859-1 encoding (European characters), but I'm struggling with half-baked
67
+ solutions for UTF-8 encoded documents.
68
+
69
+ * Implement the [new meta-data proposal][proposal].
70
+
71
+ * Exporting to Markdown (pretty printing).
72
+
73
+ * Exporting to HTML splitting in multiple files.
74
+
75
+ * RubyPants.
76
+
77
+ * Support for images in PDF.
78
+
79
+
80
+ [proposal]: http://maruku.rubyforge.org/
81
+ [contact]: http://www.dis.uniroma1.it/~acensi/contact.html
82
+ [markdown-discuss]: http://six.pairlist.net/mailman/listinfo/markdown-discuss
83
+ [tracker]: http://rubyforge.org/tracker/?group_id=2795
84
+
@@ -0,0 +1,46 @@
1
+ <?xml version='1.0' encoding='utf-8'?>
2
+ <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
3
+ 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
4
+
5
+ <html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'
6
+ ><head
7
+ ><title></title
8
+ ></head
9
+ ><head
10
+ ><title></title
11
+ ></head
12
+ ><body
13
+ ><h2 id='frequently_asked_questions'>Frequently asked questions</h2
14
+ ><ul
15
+ ><li
16
+ ><p
17
+ ><em>Does Maruku supports internationalizations?</em
18
+ ></p
19
+ ><p>Maruku assumes that documents are written in UTF-8.</p
20
+ ><p>The following are some examples of UTF-8 special chars:</p
21
+ ><blockquote
22
+ ><p>Maruku in katakana: マルク<br /
23
+ >Māku: マーク<br /
24
+ >Accented italian letters: àèéìòù<br /
25
+ >Andrea Censi: アンドレア チェンシ</p
26
+ ></blockquote
27
+ ><p>The internal format is again UTF-8.</p
28
+ ><p>The HTML output is encoded in UTF-8, and the <code>encoding</code
29
+ > is set in the xml header:</p
30
+ ><pre
31
+ ><code>&lt;?xml version=&apos;1.0&apos; encoding=&apos;utf-8&apos;?&gt;
32
+ &lt;!DOCTYPE html PUBLIC &apos;-//W3C//DTD XHTML 1.0 Strict//EN&apos;
33
+
34
+ However, the LaTeX output does not work yet for arbitrary</code
35
+ ></pre
36
+ ><p> UTF-8 strings. I need help for this.</p
37
+ ></li
38
+ ></ul
39
+ ><div class='maruku_signature'
40
+ ><hr /
41
+ ><span style='font-size: small; font-style: italic'>Created by <a href='http://maruku.rubyforge.org' title='Maruku: a Markdown interpreter'>Maruku</a
42
+ > at 18:10 on Tuesday, January 02nd, 2007.</span
43
+ ></div
44
+ ></body
45
+ ></html
46
+ >
@@ -0,0 +1,32 @@
1
+ Frequently asked questions
2
+ --------------------------
3
+
4
+
5
+ * *Does Maruku supports internationalizations?*
6
+
7
+ Maruku workflow:
8
+
9
+ * input is assumed to be in UTF-8, unless an encoding
10
+ is specified.
11
+ * the internal representation is UTF-8.
12
+ * the HTML output is in UTF-8.
13
+ * the LaTeX output does not work yet for arbitrary
14
+ UTF-8 characters (please help me if you can).
15
+
16
+ The following are some examples of UTF-8 special chars:
17
+
18
+ > Maruku in katakana: マルク
19
+ > Māku: マーク
20
+ > Accented italian letters: àèéìòù
21
+ > Andrea Censi: アンドレア チェンシ
22
+
23
+ The internal format is again UTF-8.
24
+
25
+ The HTML output is encoded in UTF-8, and
26
+ the `encoding` is set in the xml header:
27
+
28
+ <?xml version='1.0' encoding='utf-8'?>
29
+ <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
30
+
31
+ However, the LaTeX output does not work yet for arbitrary
32
+ UTF-8 strings. I need help for this.
@@ -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>