maruku 0.4.2.1 → 0.5.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/bin/maruku +66 -20
- data/bin/marutest +12 -2
- data/docs/changelog.html +188 -23
- data/docs/changelog.md +128 -5
- data/docs/entity_test.html +245 -240
- data/docs/entity_test.md +2 -0
- data/docs/exd.html +181 -23
- data/docs/index.html +130 -349
- data/docs/markdown_syntax.html +55 -51
- data/docs/maruku.html +130 -349
- data/docs/maruku.md +154 -339
- data/docs/math.md +143 -0
- data/docs/proposal.html +16 -12
- data/lib/maruku.rb +6 -3
- data/lib/maruku/attributes.rb +7 -2
- data/lib/maruku/defaults.rb +27 -27
- data/lib/maruku/errors_management.rb +10 -9
- data/lib/maruku/ext/diagrams/diagrams.rb +8 -0
- data/lib/maruku/ext/diagrams/grid.rb +78 -0
- data/lib/maruku/ext/diagrams/inspect.rb +11 -0
- data/lib/maruku/ext/diagrams/layout.rb +105 -0
- data/lib/maruku/ext/diagrams/parser.rb +219 -0
- data/lib/maruku/ext/diagrams/structures.rb +168 -0
- data/lib/maruku/ext/diagrams/to_html.rb +37 -0
- data/lib/maruku/ext/diagrams/to_latex.rb +308 -0
- data/lib/maruku/ext/diagrams/unittest.rb +123 -0
- data/lib/maruku/ext/math.rb +11 -0
- data/lib/maruku/ext/math/elements.rb +26 -0
- data/lib/maruku/ext/math/mathml_engines/blahtex.rb +108 -0
- data/lib/maruku/ext/math/mathml_engines/itex2mml.rb +29 -0
- data/lib/maruku/ext/math/mathml_engines/none.rb +20 -0
- data/lib/maruku/ext/math/mathml_engines/ritex.rb +24 -0
- data/lib/maruku/ext/math/parsing.rb +82 -0
- data/lib/maruku/ext/math/to_html.rb +178 -0
- data/lib/maruku/ext/math/to_latex.rb +21 -0
- data/lib/maruku/helpers.rb +11 -0
- data/lib/maruku/input/charsource.rb +1 -1
- data/lib/maruku/input/extensions.rb +68 -0
- data/lib/maruku/input/html_helper.rb +91 -60
- data/lib/maruku/input/parse_block.rb +10 -9
- data/lib/maruku/input/parse_doc.rb +21 -13
- data/lib/maruku/input/parse_span_better.rb +19 -8
- data/lib/maruku/input/type_detection.rb +5 -3
- data/lib/maruku/output/to_html.rb +236 -67
- data/lib/maruku/output/to_latex.rb +69 -26
- data/lib/maruku/output/to_latex_entities.rb +14 -2
- data/lib/maruku/output/to_s.rb +8 -0
- data/lib/maruku/structures.rb +1 -1
- data/lib/maruku/tests/benchmark.rb +2 -2
- data/lib/maruku/tests/new_parser.rb +13 -5
- data/lib/maruku/version.rb +1 -1
- data/lib/sort_prof.rb +22 -0
- data/tests/diagrams/diagrams.md +54 -0
- data/tests/math/syntax.md +46 -0
- data/tests/math_usage/document.md +13 -0
- data/tests/unittest/attributes/attributes.md +50 -6
- data/tests/unittest/easy.md +1 -1
- data/tests/unittest/email.md +3 -3
- data/tests/unittest/entities.md +12 -7
- data/tests/unittest/escaping.md +4 -4
- data/tests/unittest/extra_table1.md +3 -1
- data/tests/unittest/footnotes.md +5 -5
- data/tests/unittest/headers.md +3 -3
- data/tests/unittest/images.md +7 -7
- data/tests/unittest/inline_html.md +51 -5
- data/tests/unittest/links.md +7 -7
- data/tests/unittest/list2.md +1 -1
- data/tests/unittest/lists.md +1 -1
- data/tests/unittest/lists_after_paragraph.md +1 -1
- data/tests/unittest/lists_ol.md +1 -1
- data/tests/unittest/math/equations.md +82 -0
- data/tests/unittest/math/inline.md +80 -0
- data/tests/unittest/math/table.md +51 -0
- data/tests/unittest/math/table2.md +67 -0
- data/tests/unittest/misc_sw.md +24 -24
- data/tests/unittest/notyet/ticks.md +1 -1
- data/tests/unittest/references/long_example.md +2 -2
- data/tests/unittest/smartypants.md +4 -4
- data/tests/unittest/xml.md +68 -0
- data/tests/unittest/xml2.md +36 -0
- data/tests/unittest/xml3.md +52 -0
- data/tests/unittest/xml_instruction.md +5 -5
- metadata +33 -4
- data/docs/a.html +0 -6
- data/docs/char.html +0 -1924
data/docs/maruku.md
CHANGED
@@ -2,16 +2,16 @@ CSS: style.css
|
|
2
2
|
Use numbered headers: true
|
3
3
|
HTML use syntax: true
|
4
4
|
LaTeX use listings: true
|
5
|
-
LaTeX CJK:
|
5
|
+
LaTeX CJK: false
|
6
6
|
|
7
7
|
{#logo}
|
8
8
|
|
9
9
|
Mar**u**k**u**: a Markdown-superset interpreter
|
10
10
|
===============================================
|
11
11
|
|
12
|
-
[Maruku]
|
12
|
+
[Maruku] is a Markdown interpreter written in [Ruby].
|
13
13
|
|
14
|
-
> [Last release](#release_notes) is version 0.
|
14
|
+
> [Last release](#release_notes) is version 0.5.0 -- 2007-01-23.
|
15
15
|
>
|
16
16
|
> Use this command to update:
|
17
17
|
>
|
@@ -37,16 +37,16 @@ Maruku implements:
|
|
37
37
|
* the original [Markdown syntax][markdown_html]
|
38
38
|
([HTML][markdown_html] or [PDF][markdown_pdf]), translated by Maruku).
|
39
39
|
|
40
|
-
* all the improvements in [PHP Markdown Extra]
|
40
|
+
* all the improvements in [PHP Markdown Extra].
|
41
41
|
|
42
|
-
* a new [meta-data syntax][
|
42
|
+
* a new [meta-data syntax][meta_data_proposal]
|
43
43
|
|
44
44
|
|
45
|
-
__Authors__: Maruku has been developed so far by [Andrea Censi]
|
45
|
+
__Authors__: Maruku has been developed so far by [Andrea Censi].
|
46
46
|
Contributors are most welcome!
|
47
47
|
|
48
|
-
__The name of the game__: Maruku is the [romaji]
|
49
|
-
the [katakana]
|
48
|
+
__The name of the game__: Maruku is the [romaji] transliteration of
|
49
|
+
the [katakana] transliteration
|
50
50
|
of "Mark", the first word in Markdown. I chose this name because Ruby
|
51
51
|
is Japanese, and also the sillable "ru" appears in Maruku.
|
52
52
|
|
@@ -63,6 +63,25 @@ is Japanese, and also the sillable "ru" appears in Maruku.
|
|
63
63
|
[this_pdf]: http://maruku.rubyforge.org/maruku.pdf
|
64
64
|
[Andrea Censi]: http://www.dis.uniroma1.it/~acensi/
|
65
65
|
|
66
|
+
[contact]: http://www.dis.uniroma1.it/~acensi/contact.html
|
67
|
+
[gem]: http://rubygems.rubyforge.org/
|
68
|
+
[tracker]: http://rubyforge.org/tracker/?group_id=2795
|
69
|
+
|
70
|
+
|
71
|
+
[ruby]: http://www.ruby-lang.org
|
72
|
+
[bluecloth]: http://www.deveiate.org/projects/BlueCloth
|
73
|
+
[Markdown syntax]: http://daringfireball.net/projects/markdown/syntax
|
74
|
+
[PHP Markdown Extra]: http://www.michelf.com/projects/php-markdown/extra/
|
75
|
+
[math syntax]: http://maruku.rubyforge.org/math.xhtml
|
76
|
+
[blahtex]: http://www.blahtex.org
|
77
|
+
[ritex]: http://ritex.rubyforge.org
|
78
|
+
[itex2mml]: http://golem.ph.utexas.edu/~distler/code/itexToMML/
|
79
|
+
[syntax]: http://syntax.rubyforge.org/
|
80
|
+
|
81
|
+
[listings]: http://www.ctan.org/tex-archive/macros/latex/contrib/listings/
|
82
|
+
[meta_data_proposal]: http://maruku.rubyforge.org/proposal.html
|
83
|
+
[markdown-discuss]: http://six.pairlist.net/mailman/listinfo/markdown-discuss
|
84
|
+
|
66
85
|
* * *
|
67
86
|
|
68
87
|
Table of contents: (**auto-generated by Maruku!**)
|
@@ -92,142 +111,7 @@ please write to the [Markdown-discuss mailing list][markdown-discuss].
|
|
92
111
|
|
93
112
|
Have fun!
|
94
113
|
|
95
|
-
|
96
|
-
#### Changes in 0.4.2 #### {#last}
|
97
|
-
|
98
|
-
* Adapted syntax to the [new meta-data proposal][proposal].
|
99
|
-
|
100
|
-
* Changes in LaTeX export:
|
101
|
-
|
102
|
-
* Links to external URLs are blue by default.
|
103
|
-
|
104
|
-
* New attributes: `latex_preamble` to add a custom preamble,
|
105
|
-
and `latex_cjk` to add packages for UTF-8 Japanese characters.
|
106
|
-
(**support for this is still shaky**). Example:
|
107
|
-
|
108
|
-
Title: my document
|
109
|
-
LaTeX CJK: true
|
110
|
-
LaTeX preamble: preamble.tex
|
111
|
-
|
112
|
-
Content
|
113
|
-
|
114
|
-
* Bug fixes
|
115
|
-
|
116
|
-
+ Images were not given `id` or `class` attributes.
|
117
|
-
|
118
|
-
+ Fixed bug in LaTeX export with handling of `<`,`>` enclosed URLs: `<google.com>`.
|
119
|
-
|
120
|
-
#### Changes in 0.4.1 aka "Typographer" ####
|
121
|
-
|
122
|
-
* Implemented SmartyPants support:
|
123
|
-
|
124
|
-
'Twas a "test" to 'remember' -- in the '90s
|
125
|
-
--- while I was <<ok>>. She was 6\"12\'.
|
126
|
-
> 'Twas a "test" to 'remember' -- in the '90s --- while I was <<ok>>.
|
127
|
-
> She was 6\"12\'.
|
128
|
-
|
129
|
-
I adapted the code from RubyPants.
|
130
|
-
|
131
|
-
* Server directives between `<? ?>` are properly preserved.
|
132
|
-
* Changes in LaTeX export:
|
133
|
-
|
134
|
-
* Now Japanese text rendering sort of works, using the following packages:
|
135
|
-
|
136
|
-
\usepackage[C40]{fontenc}
|
137
|
-
\usepackage[cjkjis]{ucs}
|
138
|
-
\usepackage[utf8x]{inputenc}
|
139
|
-
|
140
|
-
Nevertheless, I could only get bitmap fonts working -- probably it's a problem
|
141
|
-
with my setup.
|
142
|
-
|
143
|
-
A quick test: 日本、中国、ひらがな、カタカナ。
|
144
|
-
|
145
|
-
* Fixed bugs in rendering of immediate links.
|
146
|
-
* External packages are `require`d only if needed.
|
147
|
-
* More symbols supported.
|
148
|
-
See the symbol list
|
149
|
-
[in HTML](http://maruku.rubyforge.org/entity_test.html) and
|
150
|
-
[in PDF](http://maruku.rubyforge.org/entity_test.pdf).
|
151
|
-
|
152
|
-
|
153
|
-
#### Changes in 0.4 ####
|
154
|
-
|
155
|
-
* First implementation of [the new meta-data syntax][meta].
|
156
|
-
* General refactorization of the code and much cleaner error reporting.
|
157
|
-
* Created [the RDOC documentation][rdoc].
|
158
|
-
* The `add_whitespace` method took too much time -- it was O(n^2).
|
159
|
-
* Added unit-tests for block-level elements.
|
160
|
-
|
161
|
-
[rdoc]: http://maruku.rubyforge.org/rdoc/
|
162
|
-
[meta]: http://maruku.rubyforge.org/proposal.html
|
163
|
-
|
164
|
-
#### Changes in 0.3 ####
|
165
|
-
|
166
|
-
* A real parser is used instead of a regexp-based system, also for span-level
|
167
|
-
elements.
|
168
|
-
|
169
|
-
Now Maruku is almost 2x faster than Bluecloth, while having more features.
|
170
|
-
|
171
|
-
Here are some benchmarks:
|
172
|
-
|
173
|
-
BlueCloth (to_html): parsing 0.00 sec + rendering 1.54 sec = 1.55 sec
|
174
|
-
Maruku (to_html): parsing 0.47 sec + rendering 0.38 sec = 0.85 sec
|
175
|
-
Maruku (to_latex): parsing 0.49 sec + rendering 0.25 sec = 0.73 sec
|
176
|
-
|
177
|
-
This is the result of running `lib/maruku/tests/benchmark.rb` on the Markdown
|
178
|
-
specification.
|
179
|
-
|
180
|
-
* Prettier HTML output by adding whitespace.
|
181
|
-
|
182
|
-
* Added a full suite of unit-tests for the span-level parser.
|
183
|
-
|
184
|
-
* Error management: Having a real parser, Maruku warns you about syntax issues.
|
185
|
-
|
186
|
-
The default action is to warn and try to continue. If you do this:
|
187
|
-
|
188
|
-
Maruku.new(string, {:on_error => :raise})
|
189
|
-
|
190
|
-
then syntax errors will cause an exception to be raised (you can catch this
|
191
|
-
and retry).
|
192
|
-
|
193
|
-
* Fixed a series of bugs in handling inline HTML code.
|
194
|
-
|
195
|
-
Immediate TODO-list:
|
196
|
-
|
197
|
-
* UTF-8 input/output works OK for HTML, however I am having pain trying to export
|
198
|
-
to LaTeX. I want at least Japanese characters support, so if you know how to
|
199
|
-
do this you are very welcome to give me an hand.
|
200
|
-
|
201
|
-
For example: in the HTML version, you should see accented characters in this
|
202
|
-
parenthesis:
|
203
|
-
|
204
|
-
> (àèìòù)
|
205
|
-
|
206
|
-
and Japanese text in these other parentheses:
|
207
|
-
|
208
|
-
> (カタカナで 私の 名前は アンドレア チェンシ です).
|
209
|
-
>
|
210
|
-
> (日本のガルは 大好き、でも、日本語は難しですから、そうぞ 英語話すガルを おしえてください).
|
211
|
-
|
212
|
-
In the LaTeX version, these do not appear. I know how to do LaTeX with
|
213
|
-
ISO-8859-1 encoding (European characters), but I'm struggling with half-baked
|
214
|
-
solutions for UTF-8 encoded documents.
|
215
|
-
|
216
|
-
* Implement the [new meta-data proposal][proposal].
|
217
|
-
|
218
|
-
* Exporting to Markdown (pretty printing).
|
219
|
-
|
220
|
-
* Exporting to HTML splitting in multiple files.
|
221
|
-
|
222
|
-
* RubyPants.
|
223
|
-
|
224
|
-
* Support for images in PDF.
|
225
|
-
|
226
|
-
|
227
|
-
[proposal]: http://maruku.rubyforge.org/proposal.html
|
228
|
-
[contact]: http://www.dis.uniroma1.it/~acensi/contact.html
|
229
|
-
[markdown-discuss]: http://six.pairlist.net/mailman/listinfo/markdown-discuss
|
230
|
-
[tracker]: http://rubyforge.org/tracker/?group_id=2795
|
114
|
+
See the [changelog](http://maruku.rubyforge.org/changelog.html#stable).
|
231
115
|
|
232
116
|
Download {#download}
|
233
117
|
--------
|
@@ -244,24 +128,22 @@ Released files can also be seen at <http://rubyforge.org/frs/?group_id=2795>.
|
|
244
128
|
|
245
129
|
Anonymous access to the repository is possible with:
|
246
130
|
|
247
|
-
$ svn checkout svn://rubyforge.org/var/svn/maruku
|
131
|
+
$ svn checkout svn://rubyforge.org/var/svn/maruku/trunk
|
248
132
|
|
249
133
|
{:shell}
|
250
134
|
|
251
|
-
If you want commit access to the repository, just create an account on Rubyforge and [drop me a mail][
|
252
|
-
|
253
|
-
[drop]: http://www.dis.uniroma1.it/~acensi/contact.html
|
254
|
-
[gem]: http://rubygems.rubyforge.org/
|
135
|
+
If you want commit access to the repository, just create an account on Rubyforge and [drop me a mail][contact].
|
255
136
|
|
256
137
|
### Bugs report ###
|
257
138
|
|
258
|
-
Use the [tracker][tracker] or [drop me an email][
|
139
|
+
Use the [tracker][tracker] or [drop me an email][contact].
|
259
140
|
|
260
|
-
[tracker]: http://rubyforge.org/tracker/?group_id=2795
|
261
141
|
|
262
142
|
Usage
|
263
143
|
--------
|
264
144
|
|
145
|
+
### Embedded Maruku ###
|
146
|
+
|
265
147
|
This is the basic usage:
|
266
148
|
|
267
149
|
require 'rubygems'
|
@@ -286,118 +168,97 @@ You can have the REXML document tree with:
|
|
286
168
|
|
287
169
|
### From the command line ###
|
288
170
|
|
289
|
-
There
|
290
|
-
|
291
|
-
* `maruku` converts Markdown to HTML:
|
292
|
-
|
293
|
-
$ maruku file.md # creates file.html
|
294
|
-
{:shell}
|
295
|
-
|
296
|
-
* `marutex` converts Markdown to LaTeX, then calls `pdflatex` to
|
297
|
-
transform to PDF:
|
298
|
-
|
299
|
-
$ marutex file.md # creates file.tex and file.pdf
|
300
|
-
{:shell}
|
301
|
-
|
302
|
-
|
303
|
-
Examples of PHP Markdown Extra syntax {#extra}
|
304
|
-
-------------------------------------
|
305
|
-
|
306
|
-
* tables
|
307
|
-
|
308
|
-
Col1 | Very very long head | Very very long head|
|
309
|
-
-----|:-------------------:|-------------------:|
|
310
|
-
cell | center-align | right-align |
|
311
|
-
{:markdown}
|
312
|
-
|
313
|
-
Col1 | Very very long head | Very very long head|
|
314
|
-
-----|:-------------------:|-------------------:|
|
315
|
-
cell | center-align | right-align |
|
316
|
-
|
317
|
-
|
318
|
-
* footnotes [^foot]
|
319
|
-
|
320
|
-
* footnotes [^foot]
|
321
|
-
|
322
|
-
[^foot]: I really was missing those.
|
323
|
-
{:markdown}
|
171
|
+
There is one command-line program installed: `maruku`.
|
324
172
|
|
325
|
-
|
326
|
-
|
327
|
-
* Markdown inside HTML elements
|
328
|
-
|
329
|
-
<div markdown="1" style="border: solid 1px black">
|
330
|
-
This is a div with Markdown **strong text**
|
331
|
-
</div>
|
332
|
-
{:html}
|
173
|
+
Without arguments, it converts Markdown to HTML:
|
333
174
|
|
334
|
-
|
335
|
-
|
336
|
-
</div>
|
175
|
+
$ maruku file.md # creates file.html
|
176
|
+
{:shell}
|
337
177
|
|
178
|
+
With the `--pdf` arguments, it converts Markdown to LaTeX, then calls `pdflatex` to
|
179
|
+
transform to PDF:
|
338
180
|
|
339
|
-
|
181
|
+
$ maruku --pdf file.md # creates file.tex and file.pdf
|
182
|
+
{:shell}
|
340
183
|
|
341
|
-
## Download ## {#download}
|
342
|
-
{:markdown}
|
343
184
|
|
344
|
-
|
185
|
+
Maruku and Bluecloth {#maruku-and-bluecloth}
|
186
|
+
--------------------
|
345
187
|
|
188
|
+
The other Ruby implementation of Markdown is [Bluecloth].
|
346
189
|
|
347
|
-
|
190
|
+
Maruku is much different in philosophy from Bluecloth: the biggest
|
191
|
+
difference is that *parsing* is separated from *rendering*.
|
192
|
+
In Maruku, an in-memory representation of the Markdown
|
193
|
+
document is created. Instead, Bluecloth mantains the document in
|
194
|
+
memory as a String at all times, and does a series of `gsub`
|
195
|
+
to transform to HTML.
|
348
196
|
|
349
|
-
|
350
|
-
|
351
|
-
|
197
|
+
Maruku is usually faster than Bluecloth. Bluecloth is faster
|
198
|
+
for very small documents. Bluecloth sometimes chokes on very big
|
199
|
+
documents (it is reported that the blame should be on Ruby's regexp
|
200
|
+
implementation).
|
352
201
|
|
353
|
-
|
354
|
-
|
202
|
+
This is the canonical benchmark (the Markdown specification),
|
203
|
+
executed with Ruby 1.8.5 on a Powerbook 1.5GhZ:
|
355
204
|
|
356
|
-
|
205
|
+
BlueCloth (to_html): parsing 0.01 sec + rendering 1.87 sec = 1.88 sec (1.00x)
|
206
|
+
Maruku (to_html): parsing 0.66 sec + rendering 0.43 sec = 1.09 sec (1.73x)
|
207
|
+
Maruku (to_latex): parsing 0.67 sec + rendering 0.23 sec = 0.90 sec (2.10x)
|
357
208
|
|
358
|
-
|
209
|
+
Please note that Maruku has a lot more features and therefore is
|
210
|
+
looking for much more patterns in the file.
|
359
211
|
|
360
212
|
|
361
213
|
|
362
|
-
Maruku
|
363
|
-
|
214
|
+
Maruku summary of features
|
215
|
+
--------------------------
|
364
216
|
|
365
|
-
|
217
|
+
* Supported syntax
|
218
|
+
|
219
|
+
* [Basic Markdown][markdown_syntax]
|
220
|
+
* [Markdown Extra](#extra)
|
221
|
+
* [Meta-data syntax](#meta)
|
222
|
+
|
223
|
+
* Output
|
224
|
+
|
225
|
+
* XHTML
|
226
|
+
|
227
|
+
* Syntax highlighting via the [`syntax`][syntax] library.
|
228
|
+
|
229
|
+
* LaTeX
|
366
230
|
|
367
|
-
|
368
|
-
|
369
|
-
In Maruku, an in-memory representation of the Markdown
|
370
|
-
document is created. Instead, Bluecloth mantains the document in
|
371
|
-
memory as a String at all times, and does a series of `gsub`
|
372
|
-
to transform to HTML.
|
231
|
+
* [Translation of HTML entities to LaTeX](#entities)
|
232
|
+
* Syntax highlighting via the [`listings`][listings] package.
|
373
233
|
|
374
|
-
|
375
|
-
to various formats (at the moment HTML and LaTeX/PDF;
|
376
|
-
the next is pretty-printed Markdown).
|
234
|
+
* Misc
|
377
235
|
|
378
|
-
|
236
|
+
* [Documentation for supported attributes][supported_attributes]
|
237
|
+
|
238
|
+
* [Automatic generation of the TOC](#toc-generation)
|
379
239
|
|
380
|
-
* the HTML output is provided also as a `REXML` document tree.
|
381
240
|
|
382
|
-
|
241
|
+
[supported_attributes]: exd.html
|
383
242
|
|
384
|
-
|
385
|
-
[bluecloth]: http://www.deveiate.org/projects/BlueCloth
|
386
|
-
[Markdown syntax]: http://daringfireball.net/projects/markdown/syntax
|
387
|
-
[PHP Markdown Extra]: http://www.michelf.com/projects/php-markdown/extra/
|
243
|
+
**Experimental features (not released yet)**
|
388
244
|
|
245
|
+
* [LaTeX Math syntax][math_syntax] (not enabled by default)
|
246
|
+
* An extension system for adding new syntax is available,
|
247
|
+
but the API is bound to change in the future,
|
248
|
+
so please don't use it.
|
249
|
+
* LaTeX to MathML using either one of [`ritex`][ritex], [`itex2mml`][itex2mml],
|
250
|
+
[`blahtex`][blahtex].
|
251
|
+
* LaTeX to PNG using [`blahtex`][blahtex].
|
389
252
|
|
390
|
-
New meta-data syntax {#meta}
|
391
|
-
--------------------
|
253
|
+
### New meta-data syntax {#meta}
|
392
254
|
|
393
255
|
Maruku implements a syntax that allows to attach "meta" information
|
394
256
|
to objects.
|
395
257
|
|
396
|
-
|
397
|
-
|
398
|
-
See [this proposal][meta].
|
258
|
+
See [this proposal][meta_data_proposal] for how to attach
|
259
|
+
metadata to the elements.
|
399
260
|
|
400
|
-
|
261
|
+
See the [documentation for supported attributes][supported_attributes].
|
401
262
|
|
402
263
|
Meta-data for the document itself is specified through the use
|
403
264
|
of email headers:
|
@@ -420,154 +281,108 @@ the title and stylesheet are added as expected.
|
|
420
281
|
Meta-data keys are assumed to be case-insensitive.
|
421
282
|
|
422
283
|
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
### List of meta-data ### {#metalist}
|
427
|
-
|
428
|
-
[listings]: http://www.ctan.org/tex-archive/macros/latex/contrib/listings/
|
284
|
+
### Automatic generation of the table of contents ### {#toc-generation}
|
429
285
|
|
430
|
-
|
431
|
-
|
286
|
+
If you create a list, and then set the `toc` attribute, when rendering
|
287
|
+
Maruku will create an auto-generated table of contents.
|
432
288
|
|
433
|
-
|
434
|
-
:
|
289
|
+
* This will become a table of contents (this text will be scraped).
|
290
|
+
{:toc}
|
435
291
|
|
436
|
-
|
437
|
-
: (document, HTML) Url of stylesheet.
|
292
|
+
You can see an example of this at the beginning of this document.
|
438
293
|
|
439
|
-
|
440
|
-
: (document, HTML) If set, use the [Ruby `syntax` library][syntax] to add source highlighting.
|
294
|
+
### Use HTML entities ### {#entities}
|
441
295
|
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
If not set, use standard `verbatim` environment.
|
296
|
+
If you want to use HTML entities, go on! We will take care
|
297
|
+
of the translation to LaTeX:
|
446
298
|
|
447
|
-
|
448
|
-
|
299
|
+
Entity | Result
|
300
|
+
------------|----------
|
301
|
+
`©` | ©
|
302
|
+
`£` | £
|
303
|
+
`λ` | λ
|
304
|
+
`—` | —
|
449
305
|
|
450
|
-
|
451
|
-
: (code blocks) Name of programming language (`ruby`) for syntax highlighting.
|
306
|
+
See the [list of supported entities][ent_html] ([pdf][ent_pdf]).
|
452
307
|
|
453
|
-
|
454
|
-
|
455
|
-
Syntax highlighting is delegated to the [`syntax` library][syntax] for
|
456
|
-
HTML output and to the [`listings` package][listings] for LaTeX output.
|
308
|
+
[ent_html]: http://maruku.rubyforge.org/entity_test.html
|
309
|
+
[ent_pdf]: http://maruku.rubyforge.org/entity_test.pdf
|
457
310
|
|
458
311
|
|
459
|
-
|
460
|
-
: Shows tabs and newlines (default is read in the document object).
|
312
|
+
### This header contains *emphasis* **strong text** and `code` ####
|
461
313
|
|
462
|
-
|
463
|
-
: Background color for code blocks. (default is read in the document object).
|
314
|
+
Note that this header contains formatting and it still works, also in the table of contents.
|
464
315
|
|
465
|
-
|
466
|
-
of the form `#ff00ff`.
|
316
|
+
And [This is a *link* with **all** ***sort*** of `weird stuff`](#features) in the text.
|
467
317
|
|
468
|
-
* for **HTML output**, the value is put straight in the `background-color` CSS
|
469
|
-
property of the block.
|
470
318
|
|
471
|
-
|
472
|
-
|
473
|
-
defines a color using the `\color[rgb]{r,g,b}` macro.
|
319
|
+
Examples of PHP Markdown Extra syntax {#extra}
|
320
|
+
-------------------------------------
|
474
321
|
|
475
|
-
|
322
|
+
* tables
|
476
323
|
|
477
|
-
|
324
|
+
Col1 | Very very long head | Very very long head|
|
325
|
+
-----|:-------------------:|-------------------:|
|
326
|
+
cell | center-align | right-align |
|
327
|
+
{:markdown}
|
478
328
|
|
329
|
+
Col1 | Very very long head | Very very long head|
|
330
|
+
-----|:-------------------:|-------------------:|
|
331
|
+
cell | center-align | right-align |
|
479
332
|
|
480
|
-
### Examples ###
|
481
333
|
|
482
|
-
|
334
|
+
* footnotes [^foot]
|
483
335
|
|
484
|
-
|
485
|
-
Two spaces
|
486
|
-
Tab, space, tab
|
487
|
-
Tab, tab, tab and all is green!
|
488
|
-
{:code_show_spaces code_background_color=#ffeedd}
|
489
|
-
{:markdown}
|
336
|
+
* footnotes [^foot]
|
490
337
|
|
491
|
-
|
492
|
-
|
493
|
-
One space
|
494
|
-
Two spaces
|
495
|
-
Tab, space, tab
|
496
|
-
Tab, tab, tab and all is green!
|
497
|
-
{:code_show_spaces code_background_color=#ffeedd}
|
498
|
-
|
499
|
-
|
500
|
-
Or highlighting (support depends on languages):
|
501
|
-
|
502
|
-
<div style="text-align:center">Div</div>
|
503
|
-
{:lang=html}
|
504
|
-
|
505
|
-
produces:
|
506
|
-
|
507
|
-
<div style="text-align:center">Div</div>
|
508
|
-
{:lang=html}
|
509
|
-
|
338
|
+
[^foot]: I really was missing those.
|
339
|
+
{:markdown}
|
510
340
|
|
341
|
+
[^foot]: I really was missing those.
|
511
342
|
|
512
|
-
*
|
343
|
+
* Markdown inside HTML elements
|
513
344
|
|
514
|
-
|
515
|
-
|
345
|
+
<div markdown="1" style="border: solid 1px black">
|
346
|
+
This is a div with Markdown **strong text**
|
347
|
+
</div>
|
348
|
+
{:html}
|
516
349
|
|
517
|
-
|
350
|
+
<div markdown="1" style="border: solid 1px black">
|
351
|
+
This is a div with Markdown **strong text**
|
352
|
+
</div>
|
518
353
|
|
519
|
-
If you create a list, and then set the `toc` attribute, when rendering
|
520
|
-
Maruku will create an auto-generated table of contents.
|
521
354
|
|
522
|
-
|
523
|
-
{:toc}
|
355
|
+
* header ids
|
524
356
|
|
525
|
-
|
357
|
+
## Download ## {#download}
|
358
|
+
{:markdown}
|
526
359
|
|
527
|
-
|
360
|
+
For example, [a link to the download](#download) header.
|
528
361
|
|
529
|
-
Note that this header contains formatting and it still works, also in the table of contents.
|
530
362
|
|
531
|
-
|
363
|
+
* definition lists
|
532
364
|
|
533
|
-
|
365
|
+
Definition list
|
366
|
+
: something very hard to parse
|
367
|
+
{:markdown}
|
534
368
|
|
535
|
-
|
536
|
-
|
369
|
+
Definition list
|
370
|
+
: something very hard to parse
|
537
371
|
|
538
|
-
|
539
|
-
------------|----------
|
540
|
-
`©` | ©
|
541
|
-
`£` | £
|
542
|
-
`a b` | a b
|
543
|
-
`λ` | λ
|
544
|
-
`—` | —
|
372
|
+
* abbreviations or ABB for short.
|
545
373
|
|
374
|
+
*[ABB]: Simply an abbreviation
|
546
375
|
|
547
376
|
|
548
377
|
|
378
|
+
<!--
|
549
379
|
Future developments {#future}
|
550
|
-
-------------------
|
551
380
|
|
552
|
-
I think that [Pandoc]
|
381
|
+
I think that [Pandoc] and [MultiMarkdown] are very cool projects.
|
553
382
|
However, they are written in Haskell and Perl, respectively.
|
554
383
|
I would love to have an equivalent in Ruby.
|
555
384
|
|
556
385
|
[Pandoc]: http://sophos.berkeley.edu/macfarlane/pandoc/
|
557
386
|
[MultiMarkdown]: http://fletcher.freeshell.org/wiki/MultiMarkdown
|
558
387
|
|
559
|
-
|
560
|
-
### A syntax for adding math ###
|
561
|
-
|
562
|
-
Something inspired from LaTeX should be familiar to all:
|
563
|
-
|
564
|
-
This is inline math: $\alpha$
|
565
|
-
|
566
|
-
|
567
|
-
This is an equation with label:
|
568
|
-
|
569
|
-
$ \alpha = \beta + \gamma $ (eq:1)
|
570
|
-
|
571
|
-
This is a reference to equation: please see (eq:1)
|
572
|
-
|
573
|
-
|
388
|
+
-->
|