patcito-maruku 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/AUTHORS +23 -0
- data/LICENSE +340 -0
- data/README.md +73 -0
- data/bin/maruku +196 -0
- data/bin/marutex +4 -0
- data/data/entities.xml +261 -0
- data/docs/changelog.md +334 -0
- data/docs/div_syntax.md +36 -0
- data/docs/entity_test.md +23 -0
- data/docs/markdown_syntax.md +899 -0
- data/docs/maruku.md +346 -0
- data/docs/math.md +194 -0
- data/docs/other_stuff.md +51 -0
- data/docs/proposal.md +309 -0
- data/docs/website/src/bluecloth.md +25 -0
- data/docs/website/src/download.md +31 -0
- data/docs/website/src/maruku.md +261 -0
- data/docs/website/src/proposal.md +271 -0
- data/lib/maruku.rb +132 -0
- data/lib/maruku/attributes.rb +138 -0
- data/lib/maruku/defaults.rb +69 -0
- data/lib/maruku/errors.rb +89 -0
- data/lib/maruku/ext/div.rb +121 -0
- data/lib/maruku/ext/fenced_code.rb +78 -0
- data/lib/maruku/ext/math.rb +37 -0
- data/lib/maruku/ext/math/elements.rb +21 -0
- data/lib/maruku/ext/math/latex_fix.rb +12 -0
- data/lib/maruku/ext/math/mathml_engines/blahtex.rb +93 -0
- data/lib/maruku/ext/math/mathml_engines/itex2mml.rb +39 -0
- data/lib/maruku/ext/math/mathml_engines/none.rb +21 -0
- data/lib/maruku/ext/math/mathml_engines/ritex.rb +24 -0
- data/lib/maruku/ext/math/parsing.rb +125 -0
- data/lib/maruku/ext/math/to_html.rb +237 -0
- data/lib/maruku/ext/math/to_latex.rb +36 -0
- data/lib/maruku/ext/yaml.rb +43 -0
- data/lib/maruku/helpers.rb +214 -0
- data/lib/maruku/input/charsource.rb +326 -0
- data/lib/maruku/input/extensions.rb +69 -0
- data/lib/maruku/input/html_helper.rb +189 -0
- data/lib/maruku/input/linesource.rb +111 -0
- data/lib/maruku/input/parse_block.rb +608 -0
- data/lib/maruku/input/parse_doc.rb +240 -0
- data/lib/maruku/input/parse_span_better.rb +746 -0
- data/lib/maruku/input/rubypants.rb +225 -0
- data/lib/maruku/input/type_detection.rb +147 -0
- data/lib/maruku/input_textile2/t2_parser.rb +163 -0
- data/lib/maruku/maruku.rb +31 -0
- data/lib/maruku/output/s5/fancy.rb +756 -0
- data/lib/maruku/output/s5/to_s5.rb +138 -0
- data/lib/maruku/output/to_html.rb +994 -0
- data/lib/maruku/output/to_latex.rb +580 -0
- data/lib/maruku/output/to_latex_entities.rb +101 -0
- data/lib/maruku/output/to_latex_strings.rb +64 -0
- data/lib/maruku/output/to_markdown.rb +164 -0
- data/lib/maruku/output/to_s.rb +54 -0
- data/lib/maruku/string_utils.rb +185 -0
- data/lib/maruku/structures.rb +143 -0
- data/lib/maruku/structures_inspect.rb +51 -0
- data/lib/maruku/structures_iterators.rb +48 -0
- data/lib/maruku/textile2.rb +1 -0
- data/lib/maruku/toc.rb +214 -0
- data/lib/maruku/usage/example1.rb +33 -0
- data/lib/maruku/version +0 -0
- data/lib/maruku/version.rb +54 -0
- data/spec/block_docs/abbreviations.md +52 -0
- data/spec/block_docs/alt.md +17 -0
- data/spec/block_docs/attributes/att2.md +20 -0
- data/spec/block_docs/attributes/att3.md +28 -0
- data/spec/block_docs/attributes/attributes.md +57 -0
- data/spec/block_docs/attributes/circular.md +26 -0
- data/spec/block_docs/attributes/default.md +22 -0
- data/spec/block_docs/blank.md +24 -0
- data/spec/block_docs/blanks_in_code.md +75 -0
- data/spec/block_docs/bug_def.md +16 -0
- data/spec/block_docs/bug_table.md +46 -0
- data/spec/block_docs/code.md +34 -0
- data/spec/block_docs/code2.md +28 -0
- data/spec/block_docs/code3.md +71 -0
- data/spec/block_docs/data_loss.md +25 -0
- data/spec/block_docs/divs/div1.md +167 -0
- data/spec/block_docs/divs/div2.md +21 -0
- data/spec/block_docs/divs/div3_nest.md +45 -0
- data/spec/block_docs/easy.md +15 -0
- data/spec/block_docs/email.md +20 -0
- data/spec/block_docs/encoding/iso-8859-1.md +23 -0
- data/spec/block_docs/encoding/utf-8.md +18 -0
- data/spec/block_docs/entities.md +94 -0
- data/spec/block_docs/escaping.md +67 -0
- data/spec/block_docs/extra_dl.md +52 -0
- data/spec/block_docs/extra_header_id.md +63 -0
- data/spec/block_docs/extra_table1.md +37 -0
- data/spec/block_docs/footnotes.md +97 -0
- data/spec/block_docs/headers.md +37 -0
- data/spec/block_docs/hex_entities.md +37 -0
- data/spec/block_docs/hrule.md +39 -0
- data/spec/block_docs/html2.md +22 -0
- data/spec/block_docs/html3.md +31 -0
- data/spec/block_docs/html4.md +25 -0
- data/spec/block_docs/html5.md +23 -0
- data/spec/block_docs/ie.md +49 -0
- data/spec/block_docs/images.md +90 -0
- data/spec/block_docs/images2.md +31 -0
- data/spec/block_docs/inline_html.md +152 -0
- data/spec/block_docs/inline_html2.md +21 -0
- data/spec/block_docs/links.md +152 -0
- data/spec/block_docs/links2.md +22 -0
- data/spec/block_docs/list1.md +46 -0
- data/spec/block_docs/list12.md +28 -0
- data/spec/block_docs/list2.md +56 -0
- data/spec/block_docs/list3.md +64 -0
- data/spec/block_docs/list4.md +89 -0
- data/spec/block_docs/lists.md +192 -0
- data/spec/block_docs/lists10.md +34 -0
- data/spec/block_docs/lists11.md +23 -0
- data/spec/block_docs/lists6.md +41 -0
- data/spec/block_docs/lists9.md +64 -0
- data/spec/block_docs/lists_after_paragraph.md +208 -0
- data/spec/block_docs/lists_ol.md +262 -0
- data/spec/block_docs/loss.md +16 -0
- data/spec/block_docs/math/equations.md +45 -0
- data/spec/block_docs/math/inline.md +46 -0
- data/spec/block_docs/math/math2.md +45 -0
- data/spec/block_docs/math/notmath.md +25 -0
- data/spec/block_docs/math/table.md +25 -0
- data/spec/block_docs/math/table2.md +42 -0
- data/spec/block_docs/misc_sw.md +525 -0
- data/spec/block_docs/notyet/escape.md +21 -0
- data/spec/block_docs/notyet/header_after_par.md +58 -0
- data/spec/block_docs/notyet/ticks.md +18 -0
- data/spec/block_docs/notyet/triggering.md +157 -0
- data/spec/block_docs/olist.md +45 -0
- data/spec/block_docs/one.md +15 -0
- data/spec/block_docs/paragraph.md +16 -0
- data/spec/block_docs/paragraph_rules/dont_merge_ref.md +42 -0
- data/spec/block_docs/paragraph_rules/tab_is_blank.md +24 -0
- data/spec/block_docs/paragraphs.md +46 -0
- data/spec/block_docs/pending/amps.md +15 -0
- data/spec/block_docs/pending/empty_cells.md +37 -0
- data/spec/block_docs/pending/link.md +72 -0
- data/spec/block_docs/pending/ref.md +21 -0
- data/spec/block_docs/recover/recover_links.md +15 -0
- data/spec/block_docs/red_tests/abbrev.md +679 -0
- data/spec/block_docs/red_tests/lists7.md +32 -0
- data/spec/block_docs/red_tests/lists7b.md +65 -0
- data/spec/block_docs/red_tests/lists8.md +42 -0
- data/spec/block_docs/red_tests/ref.md +23 -0
- data/spec/block_docs/red_tests/xml.md +35 -0
- data/spec/block_docs/references/long_example.md +71 -0
- data/spec/block_docs/references/spaces_and_numbers.md +15 -0
- data/spec/block_docs/smartypants.md +114 -0
- data/spec/block_docs/syntax_hl.md +52 -0
- data/spec/block_docs/table_attributes.md +34 -0
- data/spec/block_docs/test.md +19 -0
- data/spec/block_docs/underscore_in_words.md +15 -0
- data/spec/block_docs/wrapping.md +67 -0
- data/spec/block_docs/xml2.md +19 -0
- data/spec/block_docs/xml3.md +26 -0
- data/spec/block_docs/xml_instruction.md +52 -0
- data/spec/block_spec.rb +49 -0
- data/spec/span_spec.rb +254 -0
- data/spec/spec_helper.rb +6 -0
- metadata +247 -0
data/docs/other_stuff.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
* *Jan. 22* With very minimal changes, Maruku now works in JRuby.
|
2
|
+
It is very slow, though.
|
3
|
+
|
4
|
+
Some benchmarks:
|
5
|
+
|
6
|
+
* G4 1.5GhZ, Ruby 1.8.5:
|
7
|
+
|
8
|
+
Maruku (to_html): parsing 0.65 sec + rendering 0.40 sec = 1.04 sec
|
9
|
+
Maruku (to_latex): parsing 0.70 sec + rendering 0.21 sec = 0.91 sec
|
10
|
+
|
11
|
+
* G4 1.5GhZ, JRuby 1.9.2:
|
12
|
+
|
13
|
+
Maruku (to_html): parsing 4.77 sec + rendering 2.24 sec = 7.01 sec
|
14
|
+
Maruku (to_latex): parsing 4.04 sec + rendering 1.12 sec = 5.16 sec
|
15
|
+
|
16
|
+
* *Jan. 21* Integration of Blahtex. PNG export of formula and alignment works
|
17
|
+
ok in Mozilla, Safari, Camino, Opera. IE7 is acting strangely.
|
18
|
+
|
19
|
+
* Support for LaTeX-style formula input, and export to MathML.
|
20
|
+
|
21
|
+
[Jacques Distler] is integrating Maruku into Instiki (a Ruby On Rails-based wiki software), as to have a Ruby wiki with proper math support. You know, these physicists like all those funny symbols.
|
22
|
+
|
23
|
+
* To have the MathML export, it is needed to install one of:
|
24
|
+
|
25
|
+
* [RiTeX] (`gem install ritex`)
|
26
|
+
* [itex2MML] supports much more complex formulas than Ritex.
|
27
|
+
* PNG for old browser is not here yet. The plan is to use
|
28
|
+
BlahTeX.
|
29
|
+
|
30
|
+
|
31
|
+
* Command line options for the `maruku` command:
|
32
|
+
|
33
|
+
Usage: maruku [options] [file1.md [file2.md ...
|
34
|
+
-v, --[no-]verbose Run verbosely
|
35
|
+
-u, --[no-]unsafe Use unsafe features
|
36
|
+
-b Break on error
|
37
|
+
-m, --math-engine ENGINE Uses ENGINE to render MathML
|
38
|
+
--pdf Write PDF
|
39
|
+
--html Write HTML
|
40
|
+
--tex Write LaTeX
|
41
|
+
--inspect Shows the parsing result
|
42
|
+
--version Show version
|
43
|
+
-h, --help Show this message
|
44
|
+
|
45
|
+
* Other things:
|
46
|
+
|
47
|
+
* Created the embryo of an extension system. Please don't use it
|
48
|
+
yet, as probably the API is bound to change.
|
49
|
+
|
50
|
+
* There are a couple of hidden, unsafe, features that are not enabled by default.
|
51
|
+
|
data/docs/proposal.md
ADDED
@@ -0,0 +1,309 @@
|
|
1
|
+
CSS: style.css
|
2
|
+
LaTeX_use_listings: true
|
3
|
+
html_use_syntax: true
|
4
|
+
use_numbered_headers: true
|
5
|
+
|
6
|
+
Proposal for adding a meta-data syntax to Markdown
|
7
|
+
=============================================
|
8
|
+
|
9
|
+
This document describes a syntax for attaching meta-data to
|
10
|
+
block-level elements (headers, paragraphs, code blocks,…),
|
11
|
+
and to span-level elements (links, images,…).
|
12
|
+
|
13
|
+
***Note: this is an evolving proposal***
|
14
|
+
|
15
|
+
Last updated **January 10th, 2007**:
|
16
|
+
|
17
|
+
* Changed the syntax for compatibility with a future extension mechanism.
|
18
|
+
|
19
|
+
The first character in the curly braces must be a colon, optionally
|
20
|
+
followed by a space:
|
21
|
+
|
22
|
+
{: ref .class #id}
|
23
|
+
|
24
|
+
The old syntax was `{ref .class #id}`.
|
25
|
+
|
26
|
+
For ALDs, the new syntax is:
|
27
|
+
|
28
|
+
{:ref_id: key=val .class #id }
|
29
|
+
|
30
|
+
instead of:
|
31
|
+
|
32
|
+
{ref_id}: key=val .class #id
|
33
|
+
|
34
|
+
Converters that don't use this syntax may just ignore everything
|
35
|
+
which is in curly braces and starts with ":".
|
36
|
+
|
37
|
+
* IAL can be put both *before* and *after* the element.
|
38
|
+
There is no ambiguity as a blank line is needed between elements:
|
39
|
+
|
40
|
+
Paragraph 1
|
41
|
+
|
42
|
+
{:par2}
|
43
|
+
Paragraph 2
|
44
|
+
|
45
|
+
is equivalent to:
|
46
|
+
|
47
|
+
Paragraph 1
|
48
|
+
|
49
|
+
Paragraph 2
|
50
|
+
{:par2}
|
51
|
+
|
52
|
+
* Simplified rules for escaping.
|
53
|
+
|
54
|
+
*Table of contents:*
|
55
|
+
|
56
|
+
> * Table of contents
|
57
|
+
> {:toc}
|
58
|
+
|
59
|
+
Overview
|
60
|
+
--------
|
61
|
+
|
62
|
+
This proposal describes two additions to the Markdown syntax:
|
63
|
+
|
64
|
+
1. inline attribute lists (IAL)
|
65
|
+
|
66
|
+
## Header ## {: key=val .class #id ref_id}
|
67
|
+
|
68
|
+
2. attribute lists definitions (ALD)
|
69
|
+
|
70
|
+
{:ref_id: key=val .class #id}
|
71
|
+
|
72
|
+
Every span-level or block-level element can be followed by an IAL:
|
73
|
+
|
74
|
+
### Header ### {: #header1 class=c1}
|
75
|
+
|
76
|
+
Paragraph *with emphasis*{: class=c1}
|
77
|
+
second line of paragraph
|
78
|
+
{: class=c1}
|
79
|
+
|
80
|
+
In this example, the three IALs refer to the header, the emphasis span, and the entire paragraph, respectively.
|
81
|
+
|
82
|
+
IALs can reference ALDs. The result of the following example is the same as the previous one:
|
83
|
+
|
84
|
+
### Header ### {: #header1 c1}
|
85
|
+
|
86
|
+
Paragraph *with emphasis*{:c1}
|
87
|
+
second line of paragraph
|
88
|
+
{:c1}
|
89
|
+
|
90
|
+
{:c1: class=c1}
|
91
|
+
|
92
|
+
Attribute lists
|
93
|
+
---------------
|
94
|
+
|
95
|
+
This is an example attribute list, which shows
|
96
|
+
everything you can put inside:
|
97
|
+
|
98
|
+
{: key1=val key2="long val" #myid .class1 .class2 ref1 ref2}
|
99
|
+
|
100
|
+
More in particular, an attribute list is a whitespace-separated list
|
101
|
+
of elements of 4 different kinds:
|
102
|
+
|
103
|
+
1. key/value pairs (quoted if necessary)
|
104
|
+
2. [references to ALD](#using_tags) (`ref1`,`ref2`)
|
105
|
+
3. [id specifiers](#class_id) (`#myid`)
|
106
|
+
4. [class specifiers](#class_id) (`.myclass`)
|
107
|
+
|
108
|
+
### `id` and `class` are special ### {#class_id}
|
109
|
+
|
110
|
+
For ID and classes there are special shortcuts:
|
111
|
+
|
112
|
+
* `#myid` is a shortcut for `id=myid`
|
113
|
+
* `.myclass` means "add `myclass` to the current `class` attribute".
|
114
|
+
|
115
|
+
So these are equivalent:
|
116
|
+
|
117
|
+
{: .class1 .class2}
|
118
|
+
{: class="class1 class2"}
|
119
|
+
|
120
|
+
|
121
|
+
The following attribute lists are equivalent:
|
122
|
+
|
123
|
+
{: #myid .class1 .class2}
|
124
|
+
{: id=myid class=class1 .class2}
|
125
|
+
{: id=myid class="class1 class2"}
|
126
|
+
{: id=myid class="will be overridden" class=class1 .class2}
|
127
|
+
|
128
|
+
Where to put inline attribute lists
|
129
|
+
----------------------------------
|
130
|
+
|
131
|
+
### For block-level elements ###
|
132
|
+
|
133
|
+
For paragraphs and other block-level elements, IAL go
|
134
|
+
**after** the element:
|
135
|
+
|
136
|
+
This is a paragraph.
|
137
|
+
Line 2 of the paragraph.
|
138
|
+
{: #myid .myclass}
|
139
|
+
|
140
|
+
A quote with a citation url:
|
141
|
+
> Who said that?
|
142
|
+
{: cite=google.com}
|
143
|
+
|
144
|
+
Note: empty lines between the block and the IAL are not tolerated.
|
145
|
+
So this is not legal:
|
146
|
+
|
147
|
+
This is a paragraph.
|
148
|
+
Line 2 of the paragraph.
|
149
|
+
|
150
|
+
{: #myid .myclass}
|
151
|
+
|
152
|
+
Attribute lists may be indented up to 3 spaces:
|
153
|
+
|
154
|
+
Paragraph1
|
155
|
+
{:ok}
|
156
|
+
|
157
|
+
Paragraph2
|
158
|
+
{:ok}
|
159
|
+
|
160
|
+
Paragraph2
|
161
|
+
{:ok}
|
162
|
+
{:code_show_spaces}
|
163
|
+
|
164
|
+
### For headers ###
|
165
|
+
|
166
|
+
For headers, you can put attribute lists on the same line:
|
167
|
+
|
168
|
+
### Header ### {: #myid}
|
169
|
+
|
170
|
+
Header {: #myid .myclass}
|
171
|
+
------
|
172
|
+
|
173
|
+
or, as like other block-level elements, on the line below:
|
174
|
+
|
175
|
+
### Header ###
|
176
|
+
{: #myid}
|
177
|
+
|
178
|
+
Header
|
179
|
+
------
|
180
|
+
{: #myid .myclass}
|
181
|
+
|
182
|
+
### For span-level elements ###
|
183
|
+
|
184
|
+
For span-level elements, meta-data goes immediately **after** in the
|
185
|
+
flow.
|
186
|
+
|
187
|
+
For example, in this:
|
188
|
+
|
189
|
+
This is a *chunky paragraph*{: #id1}
|
190
|
+
{: #id2}
|
191
|
+
|
192
|
+
the ID of the `em` element is set to `id1`
|
193
|
+
and the ID of the paragraph is set to `id2`.
|
194
|
+
|
195
|
+
This works also for links, like this:
|
196
|
+
|
197
|
+
This is [a link][ref]{:#myid rel=abc rev=abc}
|
198
|
+
|
199
|
+
For images, this:
|
200
|
+
|
201
|
+
This is 
|
202
|
+
|
203
|
+
is equivalent to:
|
204
|
+
|
205
|
+
This is {:title="fresh carrots"}
|
206
|
+
|
207
|
+
Using attributes lists definition {#using_tags}
|
208
|
+
---------------------------------
|
209
|
+
|
210
|
+
In an attribute list, you can have:
|
211
|
+
|
212
|
+
1. `key=value` pairs,
|
213
|
+
2. id attributes (`#myid`)
|
214
|
+
3. class attributes (`.myclass`)
|
215
|
+
|
216
|
+
Everything else is interpreted as a reference to
|
217
|
+
an ALD.
|
218
|
+
|
219
|
+
# Header # {:ref}
|
220
|
+
|
221
|
+
Blah blah blah.
|
222
|
+
|
223
|
+
{:ref: #myhead .myclass lang=fr}
|
224
|
+
|
225
|
+
Of course, more than one IAL can reference the same ALD:
|
226
|
+
|
227
|
+
# Header 1 # {:1}
|
228
|
+
...
|
229
|
+
# Header 2 # {:1}
|
230
|
+
|
231
|
+
{:1: .myclass lang=fr}
|
232
|
+
|
233
|
+
|
234
|
+
The rules {:#grammar}
|
235
|
+
---------
|
236
|
+
|
237
|
+
### The issue of escaping ###
|
238
|
+
|
239
|
+
1. No escaping in code spans/blocks.
|
240
|
+
|
241
|
+
2. Everywhere else, **all** PUNCTUATION characters **can** be escaped,
|
242
|
+
and **must** be escaped when they could trigger links, tables, etc.
|
243
|
+
|
244
|
+
A punctuation character is anything not a letter, a number, or whitespace
|
245
|
+
(`[^a-zA-Z0-9\s\n]`).
|
246
|
+
|
247
|
+
3. As a rule, quotes **must** be escaped inside quoted values:
|
248
|
+
|
249
|
+
* Inside `"quoted values"`, you **must** escape `"`.
|
250
|
+
* Inside `'quoted values'`, you **must** escape `'`.
|
251
|
+
|
252
|
+
* Other examples:
|
253
|
+
|
254
|
+
`"bah 'bah' bah"` = `"bah \'bah\' bah"` = `'bah \'bah\' bah'`
|
255
|
+
|
256
|
+
`'bah "bah" bah'` = `'bah \"bah\" bah'` = `"bah \"bah\" bah"`
|
257
|
+
|
258
|
+
|
259
|
+
4. There is an exception for backward compatibility, in links/images titles:
|
260
|
+
|
261
|
+
[text](url "title"with"quotes")
|
262
|
+
|
263
|
+
The exception is not valid for attribute lists and in other
|
264
|
+
contexts, where you have to use the canonical syntax.
|
265
|
+
|
266
|
+
|
267
|
+
### Syntax for attribute lists ####
|
268
|
+
|
269
|
+
Consider the following attribute list:
|
270
|
+
|
271
|
+
{: key=value ref key2="quoted value" }
|
272
|
+
|
273
|
+
In this string, `key`, `value`, and `ref` can be substituted by any
|
274
|
+
string that does not contain whitespace, or the unescaped characters `}`,`=`,`'`,`"`.
|
275
|
+
|
276
|
+
Inside a quoted value you **must** escape the other kind of quote.
|
277
|
+
|
278
|
+
Also, you **must** escape a closing curly brace `}` inside quoted values.
|
279
|
+
This rule is for making life easier for interpreter that just want to skip
|
280
|
+
the meta-data.
|
281
|
+
|
282
|
+
If you don't implement this syntax, you can get rid of the IAL by using this
|
283
|
+
regular expression (this is written in Ruby):
|
284
|
+
|
285
|
+
r = /\{:(\\\}|[^\}])*\}/
|
286
|
+
|
287
|
+
s.gsub(r, '') # ignore metadata
|
288
|
+
{:ruby}
|
289
|
+
|
290
|
+
Basically: match everything contained in a couple of `{:` and `}`, taking care
|
291
|
+
of escaping of `}`. This `\\\}|[^\}]` means: eat either any character which
|
292
|
+
is not a `}` or an escape sequence `\}`.
|
293
|
+
|
294
|
+
For this example,
|
295
|
+
|
296
|
+
this is
|
297
|
+
{: skipped="\}" val=\} bar}
|
298
|
+
|
299
|
+
for me
|
300
|
+
{: also this}
|
301
|
+
|
302
|
+
the result is:
|
303
|
+
|
304
|
+
this is
|
305
|
+
|
306
|
+
|
307
|
+
for me
|
308
|
+
|
309
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
The other Ruby implementation of Markdown is [Bluecloth].
|
3
|
+
|
4
|
+
Maruku is much different in philosophy from Bluecloth: the biggest
|
5
|
+
difference is that *parsing* is separated from *rendering*.
|
6
|
+
In Maruku, an in-memory representation of the Markdown
|
7
|
+
document is created. Instead, Bluecloth mantains the document in
|
8
|
+
memory as a String at all times, and does a series of `gsub`
|
9
|
+
to transform to HTML.
|
10
|
+
|
11
|
+
Maruku is usually faster than Bluecloth. Bluecloth is faster
|
12
|
+
for very small documents. Bluecloth sometimes chokes on very big
|
13
|
+
documents (it is reported that the blame should be on Ruby's regexp
|
14
|
+
implementation).
|
15
|
+
|
16
|
+
This is the canonical benchmark (the Markdown specification),
|
17
|
+
executed with Ruby 1.8.5 on a Powerbook 1.5GhZ:
|
18
|
+
|
19
|
+
BlueCloth (to_html): parsing 0.01 sec + rendering 1.87 sec = 1.88 sec (1.00x)
|
20
|
+
Maruku (to_html): parsing 0.66 sec + rendering 0.43 sec = 1.09 sec (1.73x)
|
21
|
+
Maruku (to_latex): parsing 0.67 sec + rendering 0.23 sec = 0.90 sec (2.10x)
|
22
|
+
|
23
|
+
Please note that Maruku has a lot more features and therefore is
|
24
|
+
looking for much more patterns in the file.
|
25
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
### Using rubygems ###
|
2
|
+
|
3
|
+
Install with:
|
4
|
+
|
5
|
+
$ gem install maruku
|
6
|
+
{:shell}
|
7
|
+
|
8
|
+
### Distribution Packages ###
|
9
|
+
|
10
|
+
Gentoo: <http://packages.gentoo.org/packages/?category=dev-ruby;name=maruku>
|
11
|
+
|
12
|
+
Debian: <http://packages.debian.org/experimental/interpreters/libmaruku-ruby>
|
13
|
+
|
14
|
+
### Repository ###
|
15
|
+
|
16
|
+
The development site is <http://rubyforge.org/projects/maruku/>.
|
17
|
+
|
18
|
+
Released files can also be seen at <http://rubyforge.org/frs/?group_id=2795>.
|
19
|
+
|
20
|
+
Anonymous access to the repository is possible with:
|
21
|
+
|
22
|
+
$ svn checkout svn://rubyforge.org/var/svn/maruku/trunk
|
23
|
+
{:shell}
|
24
|
+
|
25
|
+
Also, each version has a tag:
|
26
|
+
|
27
|
+
$ svn checkout svn://rubyforge.org/var/svn/maruku/tags/0.5.6
|
28
|
+
{:shell}
|
29
|
+
|
30
|
+
If you want commit access to the repository, just create an account on Rubyforge and drop me a mail.
|
31
|
+
|
@@ -0,0 +1,261 @@
|
|
1
|
+
CSS: style.css
|
2
|
+
Use numbered headers: true
|
3
|
+
HTML use syntax: true
|
4
|
+
LaTeX use listings: true
|
5
|
+
LaTeX CJK: false
|
6
|
+
LaTeX preamble: preamble.tex
|
7
|
+
|
8
|
+
Maruku features
|
9
|
+
===============
|
10
|
+
|
11
|
+
Maruku allows you to write in an easy-to-read-and-write syntax, like this:
|
12
|
+
|
13
|
+
> [This document in Markdown][this_md]
|
14
|
+
|
15
|
+
Then it can be translated to HTML:
|
16
|
+
|
17
|
+
> [This document in HTML][this_html]
|
18
|
+
|
19
|
+
or LaTeX, which is then converted to PDF:
|
20
|
+
|
21
|
+
> [This document in PDF][this_pdf]
|
22
|
+
|
23
|
+
Maruku implements:
|
24
|
+
|
25
|
+
* the original [Markdown syntax][markdown_html]
|
26
|
+
([HTML][markdown_html] or [PDF][markdown_pdf]), translated by Maruku.
|
27
|
+
|
28
|
+
* all the improvements in [PHP Markdown Extra].
|
29
|
+
|
30
|
+
* a new [meta-data syntax][meta_data_proposal]
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
[romaji]: http://en.wikipedia.org/wiki/Romaji
|
35
|
+
[katakana]: http://en.wikipedia.org/wiki/Katakana
|
36
|
+
|
37
|
+
[tests]: http://maruku.rubyforge.org/tests/
|
38
|
+
[maruku]: http://maruku.rubyforge.org/
|
39
|
+
[markdown_html]: http://maruku.rubyforge.org/markdown_syntax.html
|
40
|
+
[markdown_pdf]: http://maruku.rubyforge.org/markdown_syntax.pdf
|
41
|
+
[this_md]: http://maruku.rubyforge.org/maruku.md
|
42
|
+
[this_html]: http://maruku.rubyforge.org/maruku.html
|
43
|
+
[this_pdf]: http://maruku.rubyforge.org/maruku.pdf
|
44
|
+
[Andrea Censi]: http://www.dis.uniroma1.it/~acensi/
|
45
|
+
|
46
|
+
[contact]: http://www.dis.uniroma1.it/~acensi/contact.html
|
47
|
+
[gem]: http://rubygems.rubyforge.org/
|
48
|
+
[tracker]: http://rubyforge.org/tracker/?group_id=2795
|
49
|
+
|
50
|
+
|
51
|
+
[ruby]: http://www.ruby-lang.org
|
52
|
+
[bluecloth]: http://www.deveiate.org/projects/BlueCloth
|
53
|
+
[Markdown syntax]: http://daringfireball.net/projects/markdown/syntax
|
54
|
+
[PHP Markdown Extra]: http://www.michelf.com/projects/php-markdown/extra/
|
55
|
+
[math syntax]: http://maruku.rubyforge.org/math.xhtml
|
56
|
+
[blahtex]: http://www.blahtex.org
|
57
|
+
[ritex]: http://ritex.rubyforge.org
|
58
|
+
[itex2mml]: http://golem.ph.utexas.edu/~distler/code/itexToMML/
|
59
|
+
[syntax]: http://syntax.rubyforge.org/
|
60
|
+
|
61
|
+
[listings]: http://www.ctan.org/tex-archive/macros/latex/contrib/listings/
|
62
|
+
[meta_data_proposal]: http://maruku.rubyforge.org/proposal.html
|
63
|
+
[markdown-discuss]: http://six.pairlist.net/mailman/listinfo/markdown-discuss
|
64
|
+
|
65
|
+
* * *
|
66
|
+
|
67
|
+
Table of contents: (**auto-generated by Maruku!**)
|
68
|
+
|
69
|
+
* This list will contain the toc (it doesn't matter what you write here)
|
70
|
+
{:toc}
|
71
|
+
|
72
|
+
* * *
|
73
|
+
|
74
|
+
{:ruby: lang=ruby code_background_color='#efffef'}
|
75
|
+
{:shell: lang=sh code_background_color='#efefff'}
|
76
|
+
{:markdown: code_background_color='#ffefef'}
|
77
|
+
{:html: lang=xml}
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
Maruku summary of features {#features}
|
84
|
+
--------------------------
|
85
|
+
|
86
|
+
* Supported syntax
|
87
|
+
|
88
|
+
* [Basic Markdown][markdown_syntax]
|
89
|
+
* [Markdown Extra](#extra)
|
90
|
+
* [Meta-data syntax](#meta)
|
91
|
+
|
92
|
+
* Output
|
93
|
+
|
94
|
+
* XHTML
|
95
|
+
|
96
|
+
* Syntax highlighting via the [`syntax`][syntax] library.
|
97
|
+
|
98
|
+
* LaTeX
|
99
|
+
|
100
|
+
* [Translation of HTML entities to LaTeX](#entities)
|
101
|
+
* Syntax highlighting via the [`listings`][listings] package.
|
102
|
+
|
103
|
+
* Misc
|
104
|
+
|
105
|
+
* [Documentation for supported attributes][supported_attributes]
|
106
|
+
|
107
|
+
* [Automatic generation of the TOC](#toc-generation)
|
108
|
+
|
109
|
+
|
110
|
+
[supported_attributes]: exd.html
|
111
|
+
|
112
|
+
**Experimental features (not released yet)**
|
113
|
+
|
114
|
+
* [LaTeX Math syntax][math_syntax] (not enabled by default)
|
115
|
+
* An extension system for adding new syntax is available,
|
116
|
+
but the API is bound to change in the future,
|
117
|
+
so please don't use it.
|
118
|
+
* LaTeX to MathML using either one of [`ritex`][ritex], [`itex2mml`][itex2mml],
|
119
|
+
[`blahtex`][blahtex].
|
120
|
+
* LaTeX to PNG using [`blahtex`][blahtex].
|
121
|
+
|
122
|
+
### New meta-data syntax {#meta}
|
123
|
+
|
124
|
+
Maruku implements a syntax that allows to attach "meta" information
|
125
|
+
to objects.
|
126
|
+
|
127
|
+
See [this proposal][meta_data_proposal] for how to attach
|
128
|
+
metadata to the elements.
|
129
|
+
|
130
|
+
See the [documentation for supported attributes][supported_attributes].
|
131
|
+
|
132
|
+
Meta-data for the document itself is specified through the use
|
133
|
+
of email headers:
|
134
|
+
|
135
|
+
Title: A simple document containing meta-headers
|
136
|
+
CSS: style.css
|
137
|
+
|
138
|
+
Content of the document
|
139
|
+
{:markdown}
|
140
|
+
|
141
|
+
When creating the document through
|
142
|
+
|
143
|
+
Maruku.new(s).to_html_document
|
144
|
+
{:ruby}
|
145
|
+
|
146
|
+
the title and stylesheet are added as expected.
|
147
|
+
|
148
|
+
Meta-data keys are assumed to be case-insensitive.
|
149
|
+
|
150
|
+
|
151
|
+
### Automatic generation of the table of contents ### {#toc-generation}
|
152
|
+
|
153
|
+
If you create a list, and then set the `toc` attribute, when rendering
|
154
|
+
Maruku will create an auto-generated table of contents.
|
155
|
+
|
156
|
+
* This will become a table of contents (this text will be scraped).
|
157
|
+
{:toc}
|
158
|
+
|
159
|
+
You can see an example of this at the beginning of this document.
|
160
|
+
|
161
|
+
### Use HTML entities ### {#entities}
|
162
|
+
|
163
|
+
If you want to use HTML entities, go on! We will take care
|
164
|
+
of the translation to LaTeX:
|
165
|
+
|
166
|
+
Entity | Result
|
167
|
+
------------|----------
|
168
|
+
`©` | ©
|
169
|
+
`£` | £
|
170
|
+
`λ` | λ
|
171
|
+
`—` | —
|
172
|
+
|
173
|
+
See the [list of supported entities][ent_html] ([pdf][ent_pdf]).
|
174
|
+
|
175
|
+
[ent_html]: http://maruku.rubyforge.org/entity_test.html
|
176
|
+
[ent_pdf]: http://maruku.rubyforge.org/entity_test.pdf
|
177
|
+
|
178
|
+
|
179
|
+
### This header contains *emphasis* **strong text** and `code` ####
|
180
|
+
|
181
|
+
Note that this header contains formatting and it still works, also in the table of contents.
|
182
|
+
|
183
|
+
And [This is a *link* with **all** ***sort*** of `weird stuff`](#features) in the text.
|
184
|
+
|
185
|
+
|
186
|
+
Examples of PHP Markdown Extra syntax {#extra}
|
187
|
+
-------------------------------------
|
188
|
+
|
189
|
+
* tables
|
190
|
+
|
191
|
+
Col1 | Very very long head | Very very long head|
|
192
|
+
-----|:-------------------:|-------------------:|
|
193
|
+
cell | center-align | right-align |
|
194
|
+
{:markdown}
|
195
|
+
|
196
|
+
Col1 | Very very long head | Very very long head|
|
197
|
+
-----|:-------------------:|-------------------:|
|
198
|
+
cell | center-align | right-align |
|
199
|
+
|
200
|
+
|
201
|
+
* footnotes [^foot]
|
202
|
+
|
203
|
+
* footnotes [^foot]
|
204
|
+
|
205
|
+
[^foot]: I really was missing those.
|
206
|
+
{:markdown}
|
207
|
+
|
208
|
+
[^foot]: I really was missing those.
|
209
|
+
|
210
|
+
* Markdown inside HTML elements
|
211
|
+
|
212
|
+
<div markdown="1" style="border: solid 1px black">
|
213
|
+
This is a div with Markdown **strong text**
|
214
|
+
</div>
|
215
|
+
{:html}
|
216
|
+
|
217
|
+
<div markdown="1" style="border: solid 1px black">
|
218
|
+
This is a div with Markdown **strong text**
|
219
|
+
</div>
|
220
|
+
|
221
|
+
|
222
|
+
* header ids
|
223
|
+
|
224
|
+
## Download ## {#download}
|
225
|
+
{:markdown}
|
226
|
+
|
227
|
+
For example, [a link to the download](#download) header.
|
228
|
+
|
229
|
+
|
230
|
+
* definition lists
|
231
|
+
|
232
|
+
Definition list
|
233
|
+
: something very hard to parse
|
234
|
+
{:markdown}
|
235
|
+
|
236
|
+
Definition list
|
237
|
+
: something very hard to parse
|
238
|
+
|
239
|
+
* abbreviations or ABB for short.
|
240
|
+
|
241
|
+
*[ABB]: Simply an abbreviation
|
242
|
+
|
243
|
+
|
244
|
+
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
|
245
|
+
</script>
|
246
|
+
<script type="text/javascript">
|
247
|
+
_uacct = "UA-155626-2";
|
248
|
+
urchinTracker();
|
249
|
+
</script>
|
250
|
+
|
251
|
+
<!--
|
252
|
+
Future developments {#future}
|
253
|
+
|
254
|
+
I think that [Pandoc] and [MultiMarkdown] are very cool projects.
|
255
|
+
However, they are written in Haskell and Perl, respectively.
|
256
|
+
I would love to have an equivalent in Ruby.
|
257
|
+
|
258
|
+
[Pandoc]: http://sophos.berkeley.edu/macfarlane/pandoc/
|
259
|
+
[MultiMarkdown]: http://fletcher.freeshell.org/wiki/MultiMarkdown
|
260
|
+
|
261
|
+
-->
|