maruku 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. data/bin/{maruku0.3 → marudown} +6 -14
  2. data/bin/maruku +1 -1
  3. data/bin/marutest +37 -9
  4. data/docs/TOFIX.html +22 -0
  5. data/docs/TOFIX.md +3 -0
  6. data/docs/changelog-0.2.13.html +30 -0
  7. data/docs/changelog-0.2.13.md +6 -0
  8. data/docs/changelog-0.3.html +19 -5
  9. data/docs/faq.html +51 -40
  10. data/docs/faq.md +3 -3
  11. data/docs/hidden_o_n_squared.md +10 -0
  12. data/docs/index.html +84 -396
  13. data/docs/markdown_syntax.html +139 -330
  14. data/docs/markdown_syntax.md +80 -93
  15. data/docs/maruku.html +84 -396
  16. data/docs/maruku.md +88 -158
  17. data/docs/proposal.html +13 -106
  18. data/docs/proposal.md +3 -3
  19. data/docs/todo.html +38 -28
  20. data/lib/maruku.rb +77 -11
  21. data/lib/maruku/attributes.rb +186 -0
  22. data/lib/maruku/defaults.rb +40 -0
  23. data/lib/maruku/errors_management.rb +55 -39
  24. data/lib/maruku/helpers.rb +156 -72
  25. data/lib/maruku/input/charsource.rb +319 -0
  26. data/lib/maruku/{html_helper.rb → input/html_helper.rb} +30 -9
  27. data/lib/maruku/input/linesource.rb +111 -0
  28. data/lib/maruku/input/parse_block.rb +562 -0
  29. data/lib/maruku/{parse_doc.rb → input/parse_doc.rb} +60 -28
  30. data/lib/maruku/{parse_span_better.rb → input/parse_span_better.rb} +226 -256
  31. data/lib/maruku/input/type_detection.rb +137 -0
  32. data/lib/maruku/maruku.rb +33 -0
  33. data/lib/maruku/{to_html.rb → output/to_html.rb} +151 -132
  34. data/lib/maruku/{to_latex.rb → output/to_latex.rb} +31 -35
  35. data/lib/maruku/{to_latex_entities.rb → output/to_latex_entities.rb} +25 -3
  36. data/lib/maruku/output/to_latex_strings.rb +64 -0
  37. data/lib/maruku/output/to_markdown.rb +164 -0
  38. data/lib/maruku/{to_s.rb → output/to_s.rb} +6 -0
  39. data/lib/maruku/string_utils.rb +12 -181
  40. data/lib/maruku/structures.rb +91 -67
  41. data/lib/maruku/structures_inspect.rb +78 -0
  42. data/lib/maruku/structures_iterators.rb +24 -2
  43. data/lib/maruku/tests/benchmark.rb +41 -9
  44. data/lib/maruku/tests/new_parser.rb +317 -286
  45. data/lib/maruku/tests/tests.rb +20 -0
  46. data/lib/maruku/toc.rb +64 -64
  47. data/lib/maruku/usage/example1.rb +33 -0
  48. data/lib/maruku/version.rb +8 -2
  49. data/tests/unittest/abbreviations.md +27 -16
  50. data/tests/unittest/attributes/attributes.md +89 -0
  51. data/tests/unittest/attributes/circular.md +51 -0
  52. data/tests/unittest/attributes/default.md +47 -0
  53. data/tests/unittest/blank.md +10 -6
  54. data/tests/unittest/blanks_in_code.md +26 -26
  55. data/tests/unittest/code.md +9 -9
  56. data/tests/unittest/code2.md +12 -13
  57. data/tests/unittest/code3.md +34 -34
  58. data/tests/unittest/easy.md +9 -7
  59. data/tests/unittest/email.md +9 -7
  60. data/tests/unittest/encoding/iso-8859-1.md +41 -4
  61. data/tests/unittest/encoding/utf-8.md +6 -5
  62. data/tests/unittest/entities.md +52 -80
  63. data/tests/unittest/escaping.md +47 -35
  64. data/tests/unittest/extra_dl.md +19 -29
  65. data/tests/unittest/extra_header_id.md +31 -24
  66. data/tests/unittest/extra_table1.md +14 -32
  67. data/tests/unittest/footnotes.md +58 -42
  68. data/tests/unittest/headers.md +11 -11
  69. data/tests/unittest/hrule.md +14 -24
  70. data/tests/unittest/images.md +41 -26
  71. data/tests/unittest/inline_html.md +104 -56
  72. data/tests/unittest/inline_html2.md +38 -0
  73. data/tests/unittest/links.md +74 -33
  74. data/tests/unittest/list1.md +18 -15
  75. data/tests/unittest/list2.md +31 -13
  76. data/tests/unittest/list3.md +29 -28
  77. data/tests/unittest/list4.md +103 -12
  78. data/tests/unittest/lists.md +86 -53
  79. data/tests/unittest/lists6.md +53 -0
  80. data/tests/unittest/lists7.md +31 -0
  81. data/tests/unittest/lists_after_paragraph.md +105 -71
  82. data/tests/unittest/lists_ol.md +149 -73
  83. data/tests/unittest/misc_sw.md +366 -326
  84. data/tests/unittest/notyet/escape.md +10 -10
  85. data/tests/unittest/notyet/header_after_par.md +20 -14
  86. data/tests/unittest/notyet/ticks.md +8 -35
  87. data/tests/unittest/notyet/triggering.md +72 -45
  88. data/tests/unittest/olist.md +78 -0
  89. data/tests/unittest/one.md +5 -3
  90. data/tests/unittest/paragraph.md +5 -3
  91. data/tests/unittest/paragraph_rules/dont_merge_ref.md +15 -9
  92. data/tests/unittest/paragraph_rules/tab_is_blank.md +9 -5
  93. data/tests/unittest/paragraphs.md +21 -26
  94. data/tests/unittest/recover/recover_links.md +6 -5
  95. data/tests/unittest/references/long_example.md +39 -30
  96. data/tests/unittest/references/spaces_and_numbers.md +2 -2
  97. data/tests/unittest/syntax_hl.md +33 -31
  98. data/tests/unittest/test.md +4 -6
  99. data/tests/unittest/wrapping.md +43 -26
  100. metadata +160 -139
  101. data/docs/markdown_extra2.html +0 -87
  102. data/docs/markdown_extra2.md +0 -83
  103. data/docs/markdown_syntax_2.html +0 -152
  104. data/lib/maruku/parse_block.rb +0 -564
  105. data/lib/maruku/parse_span.rb +0 -451
  106. data/lib/maruku/to_latex_strings.rb +0 -59
  107. data/lib/maruku/to_markdown.rb +0 -110
  108. data/lib/test.rb +0 -29
@@ -1,44 +1,48 @@
1
1
  css: style.css
2
- latex_use_listings: true
3
- html_use_syntax: true
4
- use_numbered_headers: true
5
-
6
2
 
7
3
  Markdown: Syntax
8
4
  ================
9
5
 
10
- **Note:**
11
-
12
- This copy is translated using [Maruku][].
13
-
14
- [Maruku]: http://maruku.rubyforge.org
15
-
16
- [Here](http://daringfireball.net/projects/markdown/syntax) you can find
17
- the original by `Markdown.pl`.
18
-
19
- > [This document in Markdown](http://maruku.rubyforge.org/markdown_syntax.md)
20
- >
21
- > [This document in HTML](http://maruku.rubyforge.org/markdown_syntax.html)
22
- >
23
- > [This document in PDF](http://maruku.rubyforge.org/markdown_syntax.pdf)
24
-
25
-
26
- Table of contents: (**auto-generated by Maruku!**)
27
-
28
- @toc
29
-
30
- * This list will contain the toc (it doesn't matter what you write here)
31
-
32
-
33
-
6
+ <ul id="ProjectSubmenu">
7
+ <li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li>
8
+ <li><a href="/projects/markdown/basics" title="Markdown Basics">Basics</a></li>
9
+ <li><a class="selected" title="Markdown Syntax Documentation">Syntax</a></li>
10
+ <li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li>
11
+ <li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li>
12
+ </ul>
13
+
14
+
15
+ * [Overview](#overview)
16
+ * [Philosophy](#philosophy)
17
+ * [Inline HTML](#html)
18
+ * [Automatic Escaping for Special Characters](#autoescape)
19
+ * [Block Elements](#block)
20
+ * [Paragraphs and Line Breaks](#p)
21
+ * [Headers](#header)
22
+ * [Blockquotes](#blockquote)
23
+ * [Lists](#list)
24
+ * [Code Blocks](#precode)
25
+ * [Horizontal Rules](#hr)
26
+ * [Span Elements](#span)
27
+ * [Links](#link)
28
+ * [Emphasis](#em)
29
+ * [Code](#code)
30
+ * [Images](#img)
31
+ * [Miscellaneous](#misc)
32
+ * [Backslash Escapes](#backslash)
33
+ * [Automatic Links](#autolink)
34
+
35
+
36
+ **Note:** This document is itself written using Markdown; you
37
+ can [see the source for it by adding '.text' to the URL][src].
38
+
39
+ [src]: /projects/markdown/syntax.text
34
40
 
35
41
  * * *
36
42
 
37
- Overview {#overview}
38
- --------
43
+ <h2 id="overview">Overview</h2>
39
44
 
40
-
41
- ### Philosophy {#philosophy}
45
+ <h3 id="philosophy">Philosophy</h3>
42
46
 
43
47
  Markdown is intended to be as easy-to-read and easy-to-write as is feasible.
44
48
 
@@ -66,7 +70,7 @@ used email.
66
70
 
67
71
 
68
72
 
69
- ### Inline HTML {#html}
73
+ <h3 id="html">Inline HTML</h3>
70
74
 
71
75
  Markdown's syntax is intended for one purpose: to be used as a
72
76
  format for *writing* for the web.
@@ -93,8 +97,6 @@ to add extra (unwanted) `<p>` tags around HTML block-level tags.
93
97
 
94
98
  For example, to add an HTML table to a Markdown article:
95
99
 
96
- @ lang: html
97
-
98
100
  This is a regular paragraph.
99
101
 
100
102
  <table>
@@ -119,7 +121,7 @@ Unlike block-level HTML tags, Markdown syntax *is* processed within
119
121
  span-level tags.
120
122
 
121
123
 
122
- ### Automatic Escaping for Special Characters {#autoescape}
124
+ <h3 id="autoescape">Automatic Escaping for Special Characters</h3>
123
125
 
124
126
  In HTML, there are two characters that demand special treatment: `<`
125
127
  and `&`. Left angle brackets are used to start tags; ampersands are
@@ -148,8 +150,6 @@ into `&amp;`.
148
150
 
149
151
  So, if you want to include a copyright symbol in your article, you can write:
150
152
 
151
- @ lang: html
152
-
153
153
  &copy;
154
154
 
155
155
  and Markdown will leave it alone. But if you write:
@@ -158,8 +158,6 @@ and Markdown will leave it alone. But if you write:
158
158
 
159
159
  Markdown will translate it to:
160
160
 
161
- @ lang: html
162
-
163
161
  AT&amp;T
164
162
 
165
163
  Similarly, because Markdown supports [inline HTML](#html), if you use
@@ -170,7 +168,6 @@ such. But if you write:
170
168
 
171
169
  Markdown will translate it to:
172
170
 
173
- @ lang: html
174
171
  4 &lt; 5
175
172
 
176
173
  However, inside Markdown code spans and blocks, angle brackets and
@@ -183,15 +180,15 @@ and `&` in your example code needs to be escaped.)
183
180
  * * *
184
181
 
185
182
 
186
- ## Block Elements {#block}
183
+ <h2 id="block">Block Elements</h2>
187
184
 
188
185
 
189
- ### Paragraphs and Line Breaks {#p}
186
+ <h3 id="p">Paragraphs and Line Breaks</h3>
190
187
 
191
188
  A paragraph is simply one or more consecutive lines of text, separated
192
189
  by one or more blank lines. (A blank line is any line that looks like a
193
190
  blank line -- a line containing nothing but spaces or tabs is considered
194
- blank.) Normal paragraphs should not be intended with spaces or tabs.
191
+ blank.) Normal paragraphs should not be indented with spaces or tabs.
195
192
 
196
193
  The implication of the "one or more consecutive lines of text" rule is
197
194
  that Markdown supports "hard-wrapped" text paragraphs. This differs
@@ -212,7 +209,7 @@ work best -- and look better -- when you format them with hard breaks.
212
209
 
213
210
 
214
211
 
215
- ### Headers {#header}
212
+ <h3 id="header">Headers</h3>
216
213
 
217
214
  Markdown supports two styles of headers, [Setext] [1] and [atx] [2].
218
215
 
@@ -249,7 +246,7 @@ determines the header level.) :
249
246
  ### This is an H3 ######
250
247
 
251
248
 
252
- ### Blockquotes {#blockquote}
249
+ <h3 id="blockquote">Blockquotes</h3>
253
250
 
254
251
  Markdown uses email-style `>` characters for blockquoting. If you're
255
252
  familiar with quoting passages of text in an email message, then you
@@ -299,7 +296,7 @@ example, with BBEdit, you can make a selection and choose Increase
299
296
  Quote Level from the Text menu.
300
297
 
301
298
 
302
- ### Lists {#list}
299
+ <h3 id="list">Lists</h3>
303
300
 
304
301
  Markdown supports ordered (numbered) and unordered (bulleted) lists.
305
302
 
@@ -332,8 +329,6 @@ It's important to note that the actual numbers you use to mark the
332
329
  list have no effect on the HTML output Markdown produces. The HTML
333
330
  Markdown produces from the above list is:
334
331
 
335
- @ lang: html
336
-
337
332
  <ol>
338
333
  <li>Bird</li>
339
334
  <li>McHale</li>
@@ -389,8 +384,6 @@ items in `<p>` tags in the HTML output. For example, this input:
389
384
 
390
385
  will turn into:
391
386
 
392
- @ lang: html
393
-
394
387
  <ul>
395
388
  <li>Bird</li>
396
389
  <li>Magic</li>
@@ -404,8 +397,6 @@ But this:
404
397
 
405
398
  will turn into:
406
399
 
407
- @ lang: html
408
-
409
400
  <ul>
410
401
  <li><p>Bird</p></li>
411
402
  <li><p>Magic</p></li>
@@ -461,11 +452,11 @@ accident, by writing something like this:
461
452
  In other words, a *number-period-space* sequence at the beginning of a
462
453
  line. To avoid this, you can backslash-escape the period:
463
454
 
464
- 1986\\. What a great season.
455
+ 1986\. What a great season.
465
456
 
466
457
 
467
458
 
468
- ### Code Blocks {#precode}
459
+ <h3 id="precode">Code Blocks</h3>
469
460
 
470
461
  Pre-formatted code blocks are used for writing about programming or
471
462
  markup source code. Rather than forming normal paragraphs, the lines
@@ -481,8 +472,6 @@ block by at least 4 spaces or 1 tab. For example, given this input:
481
472
 
482
473
  Markdown will generate:
483
474
 
484
- @ lang: html
485
-
486
475
  <p>This is a normal paragraph:</p>
487
476
 
488
477
  <pre><code>This is a code block.
@@ -499,8 +488,6 @@ line of the code block. For example, this:
499
488
 
500
489
  will turn into:
501
490
 
502
- @ lang: html
503
-
504
491
  <p>Here is an example of AppleScript:</p>
505
492
 
506
493
  <pre><code>tell application "Foo"
@@ -523,7 +510,6 @@ ampersands and angle brackets. For example, this:
523
510
 
524
511
  will turn into:
525
512
 
526
- @ lang: html
527
513
  <pre><code>&lt;div class="footer"&gt;
528
514
  &amp;copy; 2004 Foo Corporation
529
515
  &lt;/div&gt;
@@ -535,12 +521,12 @@ it's also easy to use Markdown to write about Markdown's own syntax.
535
521
 
536
522
 
537
523
 
538
- ### Horizontal Rules {#hr}
524
+ <h3 id="hr">Horizontal Rules</h3>
539
525
 
540
526
  You can produce a horizontal rule tag (`<hr />`) by placing three or
541
- more hyphens or asterisks on a line by themselves. If you wish, you
542
- may use spaces between the hyphens or asterisks. Each of the following
543
- lines will produce a horizontal rule:
527
+ more hyphens, asterisks, or underscores on a line by themselves. If you
528
+ wish, you may use spaces between the hyphens or asterisks. Each of the
529
+ following lines will produce a horizontal rule:
544
530
 
545
531
  * * *
546
532
 
@@ -555,11 +541,9 @@ lines will produce a horizontal rule:
555
541
 
556
542
  * * *
557
543
 
558
- Span Elements {#span}
559
- ----------------------
560
-
544
+ <h2 id="span">Span Elements</h2>
561
545
 
562
- ### Links {#link}
546
+ <h3 id="link">Links</h3>
563
547
 
564
548
  Markdown supports two style of links: *inline* and *reference*.
565
549
 
@@ -576,7 +560,6 @@ title for the link, surrounded in quotes. For example:
576
560
 
577
561
  Will produce:
578
562
 
579
- @ lang: html
580
563
  <p>This is <a href="http://example.com/" title="Title">
581
564
  an example</a> inline link.</p>
582
565
 
@@ -605,7 +588,7 @@ on a line by itself:
605
588
  That is:
606
589
 
607
590
  * Square brackets containing the link identifier (optionally
608
- indented from the left margin using spaces or tabs);
591
+ indented from the left margin using up to three spaces);
609
592
  * followed by a colon;
610
593
  * followed by one or more spaces (or tabs);
611
594
  * followed by the URL for the link;
@@ -618,7 +601,7 @@ The following three link definitions are equivalent:
618
601
  [foo]: http://example.com/ 'Optional Title Here'
619
602
  [foo]: http://example.com/ (Optional Title Here)
620
603
 
621
- **Note:** There is a known bug in Markdown 1.0.1 which prevents
604
+ **Note:** There is a known bug in Markdown.pl 1.0.1 which prevents
622
605
  single quotes from being used to delimit link titles.
623
606
 
624
607
  The link URL may, optionally, be surrounded by angle brackets:
@@ -715,7 +698,7 @@ you can add links without interrupting the narrative flow of your
715
698
  prose.
716
699
 
717
700
 
718
- ### Emphasis {#em}
701
+ <h3 id="em">Emphasis</h3>
719
702
 
720
703
  Markdown treats asterisks (`*`) and underscores (`_`) as indicators of
721
704
  emphasis. Text wrapped with one `*` or `_` will be wrapped with an
@@ -732,7 +715,6 @@ HTML `<em>` tag; double `*`'s or `_`'s will be wrapped with an HTML
732
715
 
733
716
  will produce:
734
717
 
735
- @ lang: html
736
718
  <em>single asterisks</em>
737
719
 
738
720
  <em>single underscores</em>
@@ -759,7 +741,7 @@ escape it:
759
741
 
760
742
 
761
743
 
762
- ### Code {#code}
744
+ <h3 id="code">Code</h3>
763
745
 
764
746
  To indicate a span of code, wrap it with backtick quotes (`` ` ``).
765
747
  Unlike a pre-formatted code block, a code span indicates code within a
@@ -769,24 +751,31 @@ normal paragraph. For example:
769
751
 
770
752
  will produce:
771
753
 
772
- @ lang: html
773
754
  <p>Use the <code>printf()</code> function.</p>
774
755
 
775
- To include a literal backtick character within a code span, you can
776
- backslash escape it:
777
-
778
- `There is a literal backtick (\\`) here.`
779
-
780
- Or, if you prefer, you can use multiple backticks as the opening and
781
- closing delimiters:
756
+ To include a literal backtick character within a code span, you can use
757
+ multiple backticks as the opening and closing delimiters:
782
758
 
783
759
  ``There is a literal backtick (`) here.``
784
760
 
785
- Both of the previous two examples will produce this:
761
+ which will produce this:
786
762
 
787
- @ lang: html
788
763
  <p><code>There is a literal backtick (`) here.</code></p>
789
764
 
765
+ The backtick delimiters surrounding a code span may include spaces --
766
+ one after the opening, one before the closing. This allows you to place
767
+ literal backtick characters at the beginning or end of a code span:
768
+
769
+ A single backtick in a code span: `` ` ``
770
+
771
+ A backtick-delimited string in a code span: `` `foo` ``
772
+
773
+ will produce:
774
+
775
+ <p>A single backtick in a code span: <code>`</code></p>
776
+
777
+ <p>A backtick-delimited string in a code span: <code>`foo`</code></p>
778
+
790
779
  With a code span, ampersands and angle brackets are encoded as HTML
791
780
  entities automatically, which makes it easy to include example HTML
792
781
  tags. Markdown will turn this:
@@ -795,7 +784,6 @@ tags. Markdown will turn this:
795
784
 
796
785
  into:
797
786
 
798
- @ lang: html
799
787
  <p>Please don't use any <code>&lt;blink&gt;</code> tags.</p>
800
788
 
801
789
  You can write this:
@@ -804,13 +792,12 @@ You can write this:
804
792
 
805
793
  to produce:
806
794
 
807
- @ lang: html
808
795
  <p><code>&amp;#8212;</code> is the decimal-encoded
809
796
  equivalent of <code>&amp;mdash;</code>.</p>
810
797
 
811
798
 
812
799
 
813
- ### Images {#img}
800
+ <h3 id="img">Images</h3>
814
801
 
815
802
  Admittedly, it's fairly difficult to devise a "natural" syntax for
816
803
  placing images into a plain text document format.
@@ -850,10 +837,9 @@ use regular HTML `<img>` tags.
850
837
  * * *
851
838
 
852
839
 
853
- Miscellaneous {#misc}
854
- ---------------------
840
+ <h2 id="misc">Miscellaneous</h2>
855
841
 
856
- ### Automatic Links {#autolink}
842
+ <h3 id="autolink">Automatic Links</h3>
857
843
 
858
844
  Markdown supports a shortcut style for creating "automatic" 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:
859
845
 
@@ -861,7 +847,6 @@ Markdown supports a shortcut style for creating "automatic" links for URLs and e
861
847
 
862
848
  Markdown will turn this into:
863
849
 
864
- @ lang: html
865
850
  <a href="http://example.com/">http://example.com/</a>
866
851
 
867
852
  Automatic links for email addresses work similarly, except that
@@ -873,7 +858,6 @@ spambots. For example, Markdown will turn this:
873
858
 
874
859
  into something like this:
875
860
 
876
- @ lang: html
877
861
  <a href="&#x6D;&#x61;i&#x6C;&#x74;&#x6F;:&#x61;&#x64;&#x64;&#x72;&#x65;
878
862
  &#115;&#115;&#64;&#101;&#120;&#x61;&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;
879
863
  &#109;">&#x61;&#x64;&#x64;&#x72;&#x65;&#115;&#115;&#64;&#101;&#120;&#x61;
@@ -887,7 +871,8 @@ them. It's better than nothing, but an address published in this way
887
871
  will probably eventually start receiving spam.)
888
872
 
889
873
 
890
- ### Backslash Escapes ### {#backslash}
874
+
875
+ <h3 id="backslash">Backslash Escapes</h3>
891
876
 
892
877
  Markdown allows you to use backslash escapes to generate literal
893
878
  characters which would otherwise have special meaning in Markdown's
@@ -907,6 +892,8 @@ Markdown provides backslash escapes for the following characters:
907
892
  [] square brackets
908
893
  () parentheses
909
894
  # hash mark
895
+ + plus sign
896
+ - minus sign (hyphen)
910
897
  . dot
911
898
  ! exclamation mark
912
899
 
data/docs/maruku.html CHANGED
@@ -1,13 +1,7 @@
1
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'>
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>
4
+ <html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'><head><meta content='text/html; charset=utf-8' http-equiv='Content-type' /><title>Maruku: a Markdown-superset interpreter</title><link href='style.css' rel='stylesheet' type='text/css' /></head><body>
11
5
  <h1 id='maruku_a_markdownsuperset_interpreter'>Mar<strong>u</strong>k<strong>u</strong>: a Markdown-superset interpreter</h1>
12
6
 
13
7
  <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>
@@ -15,7 +9,7 @@
15
9
  <p>Maruku allows you to write in an easy-to-read-and-write syntax, like this:</p>
16
10
 
17
11
  <blockquote>
18
- <p><a href='http://maruku.rubyforge.org/maruku.md'>This document in Markdown</a> </p>
12
+ <p><a href='http://maruku.rubyforge.org/maruku.md'>This document in Markdown</a></p>
19
13
  </blockquote>
20
14
 
21
15
  <p>Then it can be translated to HTML:</p>
@@ -38,85 +32,43 @@
38
32
  </li>
39
33
 
40
34
  <li>
41
- <p>all the improvements in <a href='http://www.michelf.com/projects/php-markdown/extra/'>PHP Markdown Extra</a>. </p>
35
+ <p>all the improvements in <a href='http://www.michelf.com/projects/php-markdown/extra/'>PHP Markdown Extra</a>.</p>
42
36
  </li>
43
37
 
44
38
  <li>
45
- <p>a new <a href='#meta'>meta-data syntax</a></p>
39
+ <p>a new <a href='http://maruku.rubyforge.org/proposal.html'>meta-data syntax</a></p>
46
40
  </li>
47
41
  </ul>
48
42
 
49
43
  <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
44
 
51
45
  <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
46
  <hr />
54
-
55
47
  <p>Table of contents: (<strong>auto-generated by Maruku!</strong>)</p>
48
+ <div class='maruku_toc'><ul style='list-style: none;'><li><span class='maruku_section_number'>1. </span><a href='#release_notes'>Release notes</a></li><li><span class='maruku_section_number'>2. </span><a href='#download'>Download</a><ul style='list-style: none;'><li><span class='maruku_section_number'>2.1. </span><a href='#bugs_report'>Bugs report</a></li></ul></li><li><span class='maruku_section_number'>3. </span><a href='#usage'>Usage</a><ul style='list-style: none;'><li><span class='maruku_section_number'>3.1. </span><a href='#from_the_command_line'>From the command line</a></li></ul></li><li><span class='maruku_section_number'>4. </span><a href='#extra'>Examples of PHP Markdown Extra syntax</a></li><li><span class='maruku_section_number'>5. </span><a href='#maruku-and-bluecloth'>Maruku and Bluecloth</a></li><li><span class='maruku_section_number'>6. </span><a href='#meta'>New meta-data syntax</a><ul style='list-style: none;'><li><span class='maruku_section_number'>6.1. </span><a href='#metadata_for_blocklevel_and_spanlevel_elements'>Meta-data for block-level and span-level elements</a></li><li><span class='maruku_section_number'>6.2. </span><a href='#metadata_for_the_document'>Meta-data for the document</a></li><li><span class='maruku_section_number'>6.3. </span><a href='#metalist'>List of meta-data</a></li><li><span class='maruku_section_number'>6.4. </span><a href='#examples'>Examples</a></li></ul></li><li><span class='maruku_section_number'>7. </span><a href='#features'>Other Features</a><ul style='list-style: none;'><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><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><li><span class='maruku_section_number'>7.3. </span><a href='#use_html_entities'>Use HTML entities</a></li></ul></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_adding_math'>A syntax for adding math</a></li></ul></li></ul></div><hr />
49
+ <h2 id='release_notes'><span class='maruku_section_number'>1. </span>Release notes</h2>
56
50
 
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>
51
+ <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>
80
52
 
81
- <li><span class='maruku_section_number'>6.2. </span><a href='#metadata_for_elements'>Meta-data for elements</a></li>
53
+ <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>
82
54
 
83
- <li><span class='maruku_section_number'>6.3. </span><a href='#shortcuts'>Shortcuts</a></li>
55
+ <p>Have fun!</p>
84
56
 
85
- <li><span class='maruku_section_number'>6.4. </span><a href='#metalist'>List of meta-data</a></li>
57
+ <h4 id='changes_in_04'>Changes in 0.4</h4>
86
58
 
87
- <li><span class='maruku_section_number'>6.5. </span><a href='#examples'>Examples</a></li>
88
- </ul>
89
- </li>
59
+ <ul>
60
+ <li>First implementation of <a href='http://maruku.rubyforge.org/proposal.html'>the new meta-data syntax</a>.</li>
90
61
 
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>
62
+ <li>General refactorization of the code and much cleaner error reporting.</li>
94
63
 
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>
64
+ <li>Created <a href='http://maruku.rubyforge.org/rdoc/'>the RDOC documentation</a>.</li>
96
65
 
97
- <li><span class='maruku_section_number'>7.3. </span><a href='#use_html_entities'>Use HTML entities</a></li>
98
- </ul>
99
- </li>
66
+ <li>The <code>add_whitespace</code> method took too much time -- it was O(n^2).</li>
100
67
 
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>
68
+ <li>Added unit-tests for block-level elements.</li>
106
69
  </ul>
107
- </div>
108
-
109
- <hr />
110
70
 
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>
71
+ <h4 id='changes_in_03'>Changes in 0.3</h4>
120
72
 
121
73
  <ul>
122
74
  <li>
@@ -125,11 +77,9 @@
125
77
  <p>Now Maruku is almost 2x faster than Bluecloth, while having more features.</p>
126
78
 
127
79
  <p>Here are some benchmarks:</p>
128
-
129
80
  <pre><code>BlueCloth (to_html): parsing 0.00 sec + rendering 1.54 sec = 1.55 sec
130
81
  Maruku (to_html): parsing 0.47 sec + rendering 0.38 sec = 0.85 sec
131
82
  Maruku (to_latex): parsing 0.49 sec + rendering 0.25 sec = 0.73 sec</code></pre>
132
-
133
83
  <p>This is the result of running <code>lib/maruku/tests/benchmark.rb</code> on the Markdown specification.</p>
134
84
  </li>
135
85
 
@@ -145,10 +95,8 @@ Maruku (to_latex): parsing 0.49 sec + rendering 0.25 sec = 0.73 sec</code></pr
145
95
  <p>Error management: Having a real parser, Maruku warns you about syntax issues.</p>
146
96
 
147
97
  <p>The default action is to warn and try to continue. If you do this:</p>
148
-
149
98
  <pre><code>Maruku.new(string, {:on_error =&gt; :raise})
150
99
  </code></pre>
151
-
152
100
  <p>then syntax errors will cause an exception to be raised (you can catch this and retry).</p>
153
101
  </li>
154
102
 
@@ -163,13 +111,13 @@ Maruku (to_latex): parsing 0.49 sec + rendering 0.25 sec = 0.73 sec</code></pr
163
111
  <li>
164
112
  <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
113
 
166
- <p>For example: in the HTML version, you should see accented characters in this parenthesis: </p>
114
+ <p>For example: in the HTML version, you should see accented characters in this parenthesis:</p>
167
115
 
168
116
  <blockquote>
169
117
  <p>(àèìòù)</p>
170
118
  </blockquote>
171
119
 
172
- <p>and Japanese text in these other parentheses: </p>
120
+ <p>and Japanese text in these other parentheses:</p>
173
121
 
174
122
  <blockquote>
175
123
  <p>(カタカナで 私の 名前は アンドレア チェンシ です).</p>
@@ -206,17 +154,11 @@ Maruku (to_latex): parsing 0.49 sec + rendering 0.25 sec = 0.73 sec</code></pr
206
154
  <p>The development site is <a href='http://rubyforge.org/projects/maruku/'>http://rubyforge.org/projects/maruku/</a>.</p>
207
155
 
208
156
  <p>Install with:</p>
209
-
210
- <pre><code>$ gem install maruku
211
- </code></pre>
212
-
157
+ <pre class='shell' style='background-color: #efefff;'>$ gem install maruku</pre>
213
158
  <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
159
 
215
160
  <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
-
161
+ <pre class='shell' style='background-color: #efefff;'>$ svn checkout svn://rubyforge.org/var/svn/maruku</pre>
220
162
  <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
163
 
222
164
  <h3 id='bugs_report'><span class='maruku_section_number'>2.1. </span>Bugs report</h3>
@@ -226,21 +168,15 @@ Maruku (to_latex): parsing 0.49 sec + rendering 0.25 sec = 0.73 sec</code></pr
226
168
  <h2 id='usage'><span class='maruku_section_number'>3. </span>Usage</h2>
227
169
 
228
170
  <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>
171
+ <pre class='ruby' style='background-color: #efffef;'><span class='ident'>require</span> <span class='punct'>'</span><span class='string'>rubygems</span><span class='punct'>'</span>
231
172
  <span class='ident'>require</span> <span class='punct'>'</span><span class='string'>maruku</span><span class='punct'>'</span>
232
173
 
233
174
  <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>
234
175
  <span class='ident'>puts</span> <span class='ident'>doc</span><span class='punct'>.</span><span class='ident'>to_html</span></pre>
235
-
236
176
  <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
-
177
+ <pre class='ruby' style='background-color: #efffef;'><span class='ident'>puts</span> <span class='ident'>doc</span><span class='punct'>.</span><span class='ident'>to_html_document</span></pre>
240
178
  <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
-
179
+ <pre class='ruby' style='background-color: #efffef;'><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>
244
180
  <h3 id='from_the_command_line'><span class='maruku_section_number'>3.1. </span>From the command line</h3>
245
181
 
246
182
  <p>There are two command-line programs installed: <code>maruku</code> and <code>marutex</code>.</p>
@@ -248,15 +184,11 @@ Maruku (to_latex): parsing 0.49 sec + rendering 0.25 sec = 0.73 sec</code></pr
248
184
  <ul>
249
185
  <li>
250
186
  <p><code>maruku</code> converts Markdown to HTML:</p>
251
-
252
- <pre><code>$ maruku file.md # creates file.html</code></pre>
253
- </li>
187
+ <pre class='shell' style='background-color: #efefff;'>$ maruku file.md # creates file.html</pre></li>
254
188
 
255
189
  <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>
190
+ <p><code>marutex</code> converts Markdown to LaTeX, then calls <code>pdflatex</code> to transform to PDF:</p>
191
+ <pre class='shell' style='background-color: #efefff;'>$ marutex file.md # creates file.tex and file.pdf</pre></li>
260
192
  </ul>
261
193
 
262
194
  <h2 id='extra'><span class='maruku_section_number'>4. </span>Examples of PHP Markdown Extra syntax</h2>
@@ -264,76 +196,36 @@ Maruku (to_latex): parsing 0.49 sec + rendering 0.25 sec = 0.73 sec</code></pr
264
196
  <ul>
265
197
  <li>
266
198
  <p>tables</p>
267
-
268
- <pre><code>Col1 | Very very long head | Very very long head|
199
+ <pre class='markdown' style='background-color: #ffefef;'>Col1 | Very very long head | Very very long head|
269
200
  -----|:-------------------:|-------------------:|
270
- cell | center-align | right-align |
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>
201
+ cell | center-align | right-align |</pre><table><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>
287
202
 
288
203
  <li>
289
204
  <p>footnotes <sup id='fnref:1'><a href='#fn:1' rel='footnote'>1</a></sup></p>
205
+ <pre class='markdown' style='background-color: #ffefef;'>* footnotes [^foot]
290
206
 
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>
207
+ [^foot]: I really was missing those.</pre></li>
299
208
  </ul>
300
209
 
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>
210
+ <ul>
211
+ <li>
212
+ <p>Markdown inside HTML elements</p>
213
+ <pre><code>&lt;div markdown=&quot;1&quot; style=&quot;border: solid 1px black&quot;&gt;
302
214
  This is a div with Markdown **strong text**
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'>
215
+ &lt;/div&gt;</code></pre><div style='border: solid 1px black'>
306
216
  <p>This is a div with Markdown <strong>strong text</strong></p>
307
- </div>
217
+ </div></li>
308
218
 
309
- <ul>
310
219
  <li>
311
220
  <p>header ids</p>
312
-
313
- <pre><code>## Download ## {#download}
314
- </code></pre>
315
-
221
+ <pre class='markdown' style='background-color: #ffefef;'>## Download ## {#download}</pre>
316
222
  <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
223
  </li>
323
224
 
324
225
  <li>
325
226
  <p>definition lists</p>
326
-
327
- <pre><code>Definition list
328
- : something very hard to parse
329
- </code></pre>
330
-
331
- <dl>
332
- <dt>Definition list</dt>
333
-
334
- <dd>something very hard to parse</dd>
335
- </dl>
336
- </li>
227
+ <pre class='markdown' style='background-color: #ffefef;'>Definition list
228
+ : something very hard to parse</pre><dl><dt>Definition list</dt><dd>something very hard to parse</dd></dl></li>
337
229
 
338
230
  <li>
339
231
  <p>abbreviations or <abbr title='Simply an abbreviation'>ABB</abbr> for short.</p>
@@ -342,7 +234,7 @@ cell | center-align | right-align |
342
234
 
343
235
  <h2 id='maruku-and-bluecloth'><span class='maruku_section_number'>5. </span>Maruku and Bluecloth</h2>
344
236
 
345
- <p>The other Ruby implementation of Markdown is <a href='http://www.deveiate.org/projects/BlueCloth'>Bluecloth</a>. </p>
237
+ <p>The other Ruby implementation of Markdown is <a href='http://www.deveiate.org/projects/BlueCloth'>Bluecloth</a>.</p>
346
238
 
347
239
  <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
240
 
@@ -364,175 +256,50 @@ cell | center-align | right-align |
364
256
 
365
257
  <p>Maruku implements a syntax that allows to attach &quot;meta&quot; information to objects.</p>
366
258
 
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
372
- CSS: style.css
259
+ <h3 id='metadata_for_blocklevel_and_spanlevel_elements'><span class='maruku_section_number'>6.1. </span>Meta-data for block-level and span-level elements</h3>
373
260
 
374
- Content of the document
375
- </code></pre>
261
+ <p>See <a href='http://maruku.rubyforge.org/proposal.html'>this proposal</a>.</p>
376
262
 
377
- <p>When creating the document through </p>
263
+ <h3 id='metadata_for_the_document'><span class='maruku_section_number'>6.2. </span>Meta-data for the document</h3>
378
264
 
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>
265
+ <p>Meta-data for the document itself is specified through the use of email headers:</p>
266
+ <pre class='markdown' style='background-color: #ffefef;'>Title: A simple document containing meta-headers
267
+ CSS: style.css
380
268
 
269
+ Content of the document</pre>
270
+ <p>When creating the document through</p>
271
+ <pre class='ruby' style='background-color: #efffef;'><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>
381
272
  <p>the title and stylesheet are added as expected.</p>
382
273
 
383
274
  <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.
392
-
393
- Paragraph 2
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
399
- Paragraph 1 is a warning
400
-
401
- Paragraph 2
402
-
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
408
- Paragraph 1 is a 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
424
- @ id: warning1
425
- Paragraph 1 is a warning
426
- </code></pre>
427
-
428
- <p>These can also be separated by newlines:</p>
429
-
430
- <pre><code>@ class: warning
431
-
432
- @ id: warning1
433
-
434
- Paragraph 1 is a warning
435
-
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
443
- Paragraph
444
- </code></pre>
445
-
446
- <p>is equivalent to:</p>
447
-
448
- <pre><code>@ class: xyz
449
- Paragraph
450
- </code></pre>
451
-
452
- <p>This:</p>
453
-
454
- <pre><code>@ #xyz
455
- Paragraph
456
- </code></pre>
457
-
458
- <p>is equivalent to:</p>
459
-
460
- <pre><code>@ id: xyz
461
- Paragraph
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
467
-
468
- This paragraph has the attribute `test` set to `true`.
469
- </code></pre>
470
-
471
275
  <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>
276
+ <h3 id='metalist'><span class='maruku_section_number'>6.3. </span>List of meta-data</h3>
277
+ <dl><dt><strong><code>title</code>, <code>subject</code></strong></dt><dd>
479
278
  <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>
279
+ </dd><dt><strong><code>use_numbered_headers</code></strong></dt><dd>
485
280
  <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>
281
+ </dd><dt><strong><code>css</code></strong></dt><dd>
491
282
  <p>(document, HTML) Url of stylesheet.</p>
492
- </dd>
493
-
494
- <dt><strong><code>html_use_syntax</code></strong></dt>
495
-
496
- <dd>
283
+ </dd><dt><strong><code>html_use_syntax</code></strong></dt><dd>
497
284
  <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>
285
+ </dd><dt><strong><code>latex_use_listings</code></strong></dt><dd>
503
286
  <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
287
 
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>
288
+ <p>If not set, use standard <code>verbatim</code> environment.</p>
289
+ </dd><dt><strong><code>style</code>, <code>id</code>, <code>class</code></strong></dt><dd>
511
290
  <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>
291
+ </dd><dt><strong><code>lang</code></strong></dt><dd>
517
292
  <p>(code blocks) Name of programming language (<code>ruby</code>) for syntax highlighting.</p>
518
293
 
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>
294
+ <p>Default for this is <code>code_lang</code> in document.</p>
525
295
 
526
- <dd>
296
+ <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>
297
+ </dd><dt><strong><code>code_show_spaces</code></strong></dt><dd>
527
298
  <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>
299
+ </dd><dt><strong><code>code_background_color</code></strong></dt><dd>
533
300
  <p>Background color for code blocks. (default is read in the document object).</p>
534
301
 
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>
302
+ <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
303
 
537
304
  <ul>
538
305
  <li>
@@ -540,68 +307,39 @@ This paragraph has the attribute `test` set to `true`.
540
307
  </li>
541
308
 
542
309
  <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>
310
+ <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
311
 
545
312
  <p>For example, for <code>#0000ff</code>, the macro is called as: <code>\color[rgb]{0,0,1}</code>.</p>
546
313
  </li>
547
314
  </ul>
548
- </dd>
549
- </dl>
550
-
551
- <h3 id='examples'><span class='maruku_section_number'>6.5. </span>Examples</h3>
315
+ </dd></dl>
316
+ <h3 id='examples'><span class='maruku_section_number'>6.4. </span>Examples</h3>
552
317
 
553
318
  <p>An example of this is the following:</p>
554
-
555
- <pre><code>@&not;code_show_spaces;&not;code_background_color:&not;green
556
-
557
- &raquo;&nbsp;&nbsp;&nbsp;&not;One&not;space
558
- &raquo;&nbsp;&nbsp;&nbsp;&not;&not;Two&not;spaces
559
- &raquo;&nbsp;&nbsp;&nbsp;&raquo;&nbsp;&nbsp;&nbsp;&not;&raquo;&nbsp;&nbsp;&nbsp;Tab,&not;space,&not;tab
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!
561
- </code></pre>
562
-
319
+ <pre class='markdown' style='background-color: #ffefef;'> One space
320
+ Two spaces
321
+ Tab, space, tab
322
+ Tab, tab, tab and all is green!
323
+ {code_show_spaces code_background_color=#ffeedd}</pre>
563
324
  <p>That will produce:</p>
564
-
565
- <pre style='background-color: green;'><code>&not;One&not;space
325
+ <pre style='background-color: #ffeedd;'><code>&not;One&not;space
566
326
  &not;&not;Two&not;spaces
567
327
  &raquo;&nbsp;&nbsp;&nbsp;&not;&raquo;&nbsp;&nbsp;&nbsp;Tab,&not;space,&not;tab
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!
569
- </code></pre>
570
-
571
- <p>Example with css-style color:</p>
572
-
573
- <pre><code>@ code_background_color: #455678
574
-
575
- A strange color
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
586
- &lt;div style=&quot;text-align:center&quot;&gt;Div&lt;/div&gt;
328
+ &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!</code></pre>
329
+ <p>Or highlighting (support depends on languages):</p>
330
+ <pre><code> &lt;div style=&quot;text-align:center&quot;&gt;Div&lt;/div&gt;
331
+ {lang=html}
587
332
  </code></pre>
588
-
589
333
  <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>
592
-
593
- <hr />
594
-
334
+ <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><hr />
595
335
  <h2 id='features'><span class='maruku_section_number'>7. </span>Other Features</h2>
596
336
 
597
337
  <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
338
 
599
339
  <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
602
- * This will become a table of contents (this text will be scraped).
340
+ <pre><code>* This will become a table of contents (this text will be scraped).
341
+ {toc}
603
342
  </code></pre>
604
-
605
343
  <p>You can see an example of this at the beginning of this document.</p>
606
344
 
607
345
  <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>
@@ -613,43 +351,7 @@ This paragraph has the attribute `test` set to `true`.
613
351
  <h3 id='use_html_entities'><span class='maruku_section_number'>7.3. </span>Use HTML entities</h3>
614
352
 
615
353
  <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
-
354
+ <table><thead><tr><th>Entity</th><th>Result</th></tr></thead><tbody><tr><td style='text-align: left;'><code>&amp;copy;</code></td><td style='text-align: left;'>&copy;</td></tr><tr><td style='text-align: left;'><code>&amp;pound;</code></td><td style='text-align: left;'>&pound;</td></tr><tr><td style='text-align: left;'><code>a&amp;nbsp;b</code></td><td style='text-align: left;'>a&nbsp;b</td></tr><tr><td style='text-align: left;'><code>&amp;lambda;</code></td><td style='text-align: left;'>&lambda;</td></tr><tr><td style='text-align: left;'><code>&amp;mdash;</code></td><td style='text-align: left;'>&mdash;</td></tr></tbody></table>
653
355
  <h2 id='future'><span class='maruku_section_number'>8. </span>Future developments</h2>
654
356
 
655
357
  <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>
@@ -657,7 +359,6 @@ This paragraph has the attribute `test` set to `true`.
657
359
  <h3 id='a_syntax_for_adding_math'><span class='maruku_section_number'>8.1. </span>A syntax for adding math</h3>
658
360
 
659
361
  <p>Something inspired from LaTeX should be familiar to all:</p>
660
-
661
362
  <pre><code>This is inline math: $\alpha$
662
363
 
663
364
 
@@ -665,19 +366,6 @@ This is an equation with label:
665
366
 
666
367
  $ \alpha = \beta + \gamma $ (eq:1)
667
368
 
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>
679
-
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>
369
+ This is a reference to equation: please see (eq:1)</code></pre><div class='footnotes'><hr /><ol><li id='fn:1'>
370
+ <p>I really was missing those.</p>
371
+ <a href='#fnref:1' rev='footnote'>&#8617;</a></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 21:05 on Saturday, January 06th, 2007.</span></div></body></html>