maruku 0.2
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 +25 -0
- data/bin/marutex +29 -0
- data/docs/Makefile +25 -0
- data/docs/char_codes.xml +884 -0
- data/docs/color-package-demo.aux +1 -0
- data/docs/color-package-demo.log +127 -0
- data/docs/color-package-demo.tex +149 -0
- data/docs/index.html +74 -0
- data/docs/markdown_syntax.aux +13 -0
- data/docs/markdown_syntax.html +266 -0
- data/docs/markdown_syntax.log +287 -0
- data/docs/markdown_syntax.md +920 -0
- data/docs/markdown_syntax.out +0 -0
- data/docs/markdown_syntax.pdf +0 -0
- data/docs/markdown_syntax.tex +1203 -0
- data/docs/maruku.aux +13 -0
- data/docs/maruku.html +74 -0
- data/docs/maruku.log +294 -0
- data/docs/maruku.md +394 -0
- data/docs/maruku.out +0 -0
- data/docs/maruku.pdf +0 -0
- data/docs/maruku.tex +548 -0
- data/docs/style.css +65 -0
- data/docs/todo.md +12 -0
- data/lib/maruku.rb +20 -0
- data/lib/maruku/parse_block.rb +577 -0
- data/lib/maruku/parse_span.rb +336 -0
- data/lib/maruku/string_utils.rb +270 -0
- data/lib/maruku/structures.rb +31 -0
- data/lib/maruku/to_html.rb +430 -0
- data/lib/maruku/to_latex.rb +345 -0
- data/lib/maruku/to_latex_strings.rb +330 -0
- data/tests/abbreviations.md +11 -0
- data/tests/blank.md +4 -0
- data/tests/code.md +5 -0
- data/tests/code2.md +8 -0
- data/tests/code3.md +16 -0
- data/tests/email.md +4 -0
- data/tests/entities.md +19 -0
- data/tests/escaping.md +14 -0
- data/tests/extra_dl.md +101 -0
- data/tests/extra_header_id.md +13 -0
- data/tests/extra_table1.md +40 -0
- data/tests/footnotes.md +17 -0
- data/tests/headers.md +10 -0
- data/tests/hrule.md +10 -0
- data/tests/images.md +20 -0
- data/tests/inline_html.md +35 -0
- data/tests/links.md +31 -0
- data/tests/list1.md +4 -0
- data/tests/list2.md +5 -0
- data/tests/list3.md +8 -0
- data/tests/lists.md +32 -0
- data/tests/lists_ol.md +39 -0
- data/tests/misc_sw.md +105 -0
- data/tests/one.md +1 -0
- data/tests/paragraphs.md +13 -0
- data/tests/sss06.md +352 -0
- data/tests/test.md +4 -0
- metadata +113 -0
data/docs/maruku.aux
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
\relax
|
|
2
|
+
\ifx\hyper@anchor\@undefined
|
|
3
|
+
\global \let \oldcontentsline\contentsline
|
|
4
|
+
\gdef \contentsline#1#2#3#4{\oldcontentsline{#1}{#2}{#3}}
|
|
5
|
+
\global \let \oldnewlabel\newlabel
|
|
6
|
+
\gdef \newlabel#1#2{\newlabelxx{#1}#2}
|
|
7
|
+
\gdef \newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}}
|
|
8
|
+
\AtEndDocument{\let \contentsline\oldcontentsline
|
|
9
|
+
\let \newlabel\oldnewlabel}
|
|
10
|
+
\else
|
|
11
|
+
\global \let \hyper@last\relax
|
|
12
|
+
\fi
|
|
13
|
+
|
data/docs/maruku.html
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<?xml version='1.0'?>
|
|
2
|
+
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
|
|
3
|
+
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
|
|
4
|
+
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'><head><title>Maruku, a Markdown interpreter</title><link href='style.css' rel='stylesheet' type='text/css' /></head><head><title>Maruku, a Markdown interpreter</title><link href='style.css' rel='stylesheet' type='text/css' /></head><body><h1>Mar<strong>u</strong>k<strong>u</strong>: a Markdown interpreter</h1><p>Maruku is a Markdown interpreter written in <a href='http://www.ruby-lang.org'>Ruby</a>.</p><p>Maruku allows you to write in an easy-to-read-and-write syntax, like this:</p><blockquote><p><a href='http://maruku.rubyforge.org/maruku.md'>This document in Markdown</a></p></blockquote><p>Then it can be translated to HTML:</p><blockquote><p><a href='http://maruku.rubyforge.org/maruku.html'>This document in HTML</a></p></blockquote><p>or Latex, which is then converted to PDF:</p><blockquote><p><a href='http://maruku.rubyforge.org/maruku.pdf'>This document in PDF</a></p></blockquote><p>Maruku implements the original <a href='http://daringfireball.net/projects/markdown/syntax'>Markdown syntax</a> (<a href='http://maruku.rubyforge.org/markdown_syntax.html'>HTML</a> or <a href='http://maruku.rubyforge.org/markdown_syntax.pdf'>PDF</a>, translated by Maruku).</p><p>Markdown implements also all the improvements in <a href='http://www.michelf.com/projects/php-markdown/extra/'>PHP Markdown Extra</a>.</p><p>Moreover, it implements ideas from <a href='http://fletcher.freeshell.org/wiki/MultiMarkdown'>MultiMarkdown</a>.</p><hr /><p><em>Table of contents</em>:</p><ul><li><p><a href='#download'>Download</a></p></li><li><p><a href='#usage'>Usage</a></p></li><li><p><a href='#extra'>Examples of PHP Markdown extra syntax</a></p></li><li><p><a href='#meta'>New metadata syntax</a></p></li><li><p><a href='#metalist'>List of metadata</a></p></li><li><p><a href='#maruku-and-bluecloth'>Maruku and Bluecloth</a></p></li><li><p><a href='#future'>Future developments</a></p><ul><li><a href='#future-export'>Export to other formats</a></li><li><a href='#future-syntax'>Syntax additions</a></li></ul></li></ul><hr /><h2 class='head' id='download'>Download</h2><p>The development site is <a href='http://maruku.rubyforge.net/'>http://maruku.rubyforge.net/</a>.</p><p>Download current <a href='http://rubygems.rubyforge.org/'>gem</a> at <a href='http://maruku.rubyforge.net/gem1.0'>http://maruku.rubyforge.net/gem1.0</a></p><h2>Usage</h2><p>This is the basic usage:</p><pre class='ruby' style='background-color: #f0f0e0;'><span class='ident'>require</span> <span class='punct'>'</span><span class='string'>maruku</span><span class='punct'>'</span>
|
|
5
|
+
|
|
6
|
+
<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>
|
|
7
|
+
<span class='ident'>puts</span> <span class='ident'>doc</span><span class='punct'>.</span><span class='ident'>to_html</span>
|
|
8
|
+
</pre><p>or, if you install through RubyGems,</p><pre class='ruby' style='background-color: #f0f0e0;'><span class='ident'>require</span> <span class='punct'>'</span><span class='string'>rubygems</span><span class='punct'>'</span>
|
|
9
|
+
<span class='ident'>require</span> <span class='punct'>'</span><span class='string'>maruku</span><span class='punct'>'</span>
|
|
10
|
+
</pre><p>This outputs a complete XHTML 1.0 document:</p><pre class='ruby' style='background-color: #f0f0e0;'><span class='ident'>puts</span> <span class='ident'>doc</span><span class='punct'>.</span><span class='ident'>to_html_document</span></pre><p>You can have the REXML document tree with:</p><pre class='ruby' style='background-color: #f0f0e0;'><span class='ident'>tree</span> <span class='punct'>=</span> <span class='ident'>doc</span><span class='punct'>.</span><span class='ident'>to_html_document_tree</span>
|
|
11
|
+
</pre><h3>From the command line</h3><p>There are two command-line programs installed: <tt style='background-color: #f0f0e0;'>maruku</tt> and <tt style='background-color: #f0f0e0;'>marutex</tt></p><p><tt style='background-color: #f0f0e0;'>maruku</tt> converts Markdown in HTML:</p><pre style='background-color: #f0f0e0;'>$ maruku file.md # creates file.html
|
|
12
|
+
</pre><p><tt style='background-color: #f0f0e0;'>marutex</tt> converts Markdown in TeX, then calls <tt style='background-color: #f0f0e0;'>pdflatex</tt> to transform to PDF:</p><pre style='background-color: #f0f0e0;'>$ marutex file.md # creates file.tex and file.pdf
|
|
13
|
+
|
|
14
|
+
</pre><h2 id='extra'>Examples of PHP Markdown Extra syntax</h2><ul><li><p>tables</p><pre style='background-color: #f0f0e0;'>Col1 | Very very long head | Very very long head|
|
|
15
|
+
-----|:-------------------:|-------------------:|
|
|
16
|
+
cell | center-align | right-align |
|
|
17
|
+
</pre><table class='example'><thead><tr><th>Col1</th><th>Very very long head</th><th>Very very long head</th></tr></thead><tbody><tr><td style='text-align: left;'>cell</td><td style='text-align: center;'>center-align</td><td style='text-align: right;'>right-align</td></tr></tbody></table></li><li><p>footnotes <sup id='fnref:1'><a href='#fn:1' rel='footnote'>1</a></sup></p><pre style='background-color: #f0f0e0;'>*footnotes [^foot]
|
|
18
|
+
|
|
19
|
+
[^foot]: I really was missing those.</pre></li><li><p>Markdown inside HTML elememnts</p></li></ul><pre class='xml' style='background-color: #f0f0e0;'><span class='punct'><</span><span class='tag'>div</span> <span class='attribute'>markdown</span><span class='punct'>="</span><span class='string'>1</span><span class='punct'>"</span> <span class='attribute'>style</span><span class='punct'>="</span><span class='string'>border: solid 1px black</span><span class='punct'>"></span>
|
|
20
|
+
This is a div with Markdown **strong text**
|
|
21
|
+
<span class='punct'></</span><span class='tag'>div</span><span class='punct'>></span>
|
|
22
|
+
</pre><div style='border: solid 1px black'><p>This is a div with Markdown <strong>strong text</strong></p></div><ul><li><p>header ids</p><pre style='background-color: #f0f0e0;'>## Header ## {#id}</pre><p>For example, <a href='#download'>a link to the download</a> header.</p></li><li><p>definition lists</p><pre style='background-color: #f0f0e0;'>Definition list
|
|
23
|
+
: something very hard to parse
|
|
24
|
+
</pre><dl><dt>Definition list</dt><dd>something very hard to parse</dd></dl></li><li><p>abbreviations or <abbr title='Simple an abbreviation'>ABB</abbr> for short.</p></li></ul><h2 id='maruku-and-bluecloth'>Maruku and Bluecloth</h2><p>The other Ruby implementation of Markdown is <a href='http://www.deveiate.org/projects/BlueCloth'>Bluecloth</a>.</p><p>Maruku is much different in philosophy from Bluecloth: the biggest difference is that <em>parsing</em> is separated from <em>rendering</em>. In Maruku, an in-memory representation of the Markdown document is created. Instead, Bluecloth mantains the document in memory as a String at all times, and does a series of <tt style='background-color: #f0f0e0;'>gsub</tt> to transform to HTML.<sup id='fnref:2'><a href='#fn:2' rel='footnote'>2</a></sup></p><p>The in-memory representation makes it very easy to export to various formats (altough, for, now)</p><p>Other improvements over Bluecloth:</p><ul><li><p>the HTML output is provided also as a <tt style='background-color: #f0f0e0;'>REXML</tt> document tree.</p></li><li><p>PHP Markdown Syntax support.</p></li></ul><h2 id='meta'>New meta-data syntax</h2><p>Maruku implements a syntax that allows to attach "meta" information to objects.</p><h3>Meta-data for the document</h3><p>Meta-data for the document itself is specified through the use of email headers:</p><pre style='background-color: #f0f0e0;'>Title: A simple document containing meta-headers
|
|
25
|
+
CSS: style.css
|
|
26
|
+
|
|
27
|
+
Content of the document
|
|
28
|
+
</pre><p>When creating the document through</p><pre class='ruby' style='background-color: #f0f0e0;'><span class='constant'>Maruku</span><span class='punct'>.</span><span class='ident'>new</span><span class='punct'>(</span><span class='ident'>s</span><span class='punct'>).</span><span class='ident'>to_html_document</span>
|
|
29
|
+
</pre><p>the title and stylesheet are added as expected.</p><h3>Meta-data for elements</h3><p>Maruku introduces a new syntax for attaching metadata to paragraphs, tables, and so on.</p><p>For example, consider the creation of two paragraphs:</p><pre style='background-color: #f0f0e0;'>Paragraph 1 is a warning.
|
|
30
|
+
|
|
31
|
+
Paragraph 2
|
|
32
|
+
</pre><p>Now you really want to attach a 'class' attribute to the paragraphs (for example for CSS styling). Maruku allows you to use:</p><pre style='background-color: #f0f0e0;'>@ class: warning
|
|
33
|
+
Paragraph 1 is a warning
|
|
34
|
+
|
|
35
|
+
Paragraph 2
|
|
36
|
+
|
|
37
|
+
</pre><p>You can add more by separating with a <tt style='background-color: #f0f0e0;'>;</tt>:</p><pre style='background-color: #f0f0e0;'>@ class: warning; id: warning1
|
|
38
|
+
Paragraph 1 is a warning
|
|
39
|
+
</pre><p>A meta-data declaration is composed of</p><ol><li>newline</li><li>an at-symbol '@'</li><li>a series of name-value pairs. Each name-value is separated by a colon <tt style='background-color: #f0f0e0;'>:</tt>, pairs are separated by semi-colons <tt style='background-color: #f0f0e0;'>;</tt></li></ol><p>Many declaration can be used, and they refer to <em>the following</em> object:</p><pre style='background-color: #f0f0e0;'>@ class: warning
|
|
40
|
+
@ id: warning1
|
|
41
|
+
Paragraph 1 is a warning
|
|
42
|
+
</pre><p>These can also be separated by newlines:</p><pre style='background-color: #f0f0e0;'>@ class: warning
|
|
43
|
+
|
|
44
|
+
@ id: warning1
|
|
45
|
+
|
|
46
|
+
Paragraph 1 is a warning
|
|
47
|
+
</pre><p>Also, if the value is not present, it defaults to <tt style='background-color: #f0f0e0;'>true</tt>:</p><pre style='background-color: #f0f0e0;'>@ test
|
|
48
|
+
|
|
49
|
+
This paragraph has the attribute 'test' set.
|
|
50
|
+
</pre><hr /><h2 id='metalist'>List of meta-data</h2><dl><dt><strong><tt style='background-color: #f0f0e0;'>title</tt>, <tt style='background-color: #f0f0e0;'>subject</tt></strong></dt><dd><p>(document) Sets the title of the document use in <tt style='background-color: #f0f0e0;'>title</tt> element.</p></dd><dt><strong><tt style='background-color: #f0f0e0;'>css</tt></strong></dt><dd><p>(document, HTML) Url of stylesheet.</p></dd><dt><strong><tt style='background-color: #f0f0e0;'>latex_use_syntax</tt></strong></dt><dd><p>(document, HTML) Use the [<tt style='background-color: #f0f0e0;'>syntax</tt> library][syntax] to add source highlighting.</p></dd><dt><strong><tt style='background-color: #f0f0e0;'>latex_use_listings</tt></strong></dt><dd><p>(document, LaTex) Use fancy <tt style='background-color: #f0f0e0;'>listing</tt> package for better displaying code blocks.</p></dd><dt><strong><tt style='background-color: #f0f0e0;'>style</tt>, <tt style='background-color: #f0f0e0;'>id</tt>, <tt style='background-color: #f0f0e0;'>class</tt></strong></dt><dd><p>(any block object, HTML) Standard CSS attributes are copied.</p></dd><dt><strong><tt style='background-color: #f0f0e0;'>lang</tt></strong></dt><dd><p>(code blocks) Name of programming language (<tt style='background-color: #f0f0e0;'>ruby</tt>) for syntax highlighting (does not work yet)</p><p>Default for this is <tt style='background-color: #f0f0e0;'>code_lang</tt> in document.</p></dd><dt><strong><tt style='background-color: #f0f0e0;'>code_show_spaces</tt></strong></dt><dd><p>Shows tabs and newlines (default is read in the document object).</p></dd><dt><strong><tt style='background-color: #f0f0e0;'>code_background_color</tt></strong></dt><dd><p>Background color for code blocks. (default is read in the document object).</p><p>The format is either a named color (<tt style='background-color: #f0f0e0;'>green</tt>, <tt style='background-color: #f0f0e0;'>red</tt>) or a CSS color of the form <tt style='background-color: #f0f0e0;'>#ff00ff</tt>.</p><ul><li><p>for <strong>HTML output</strong>, the value is put straight in the <tt style='background-color: #f0f0e0;'>background-color</tt> CSS property of the block.</p></li><li><p>for <strong>LaTeX output</strong>, if it is a named color, it must be a color accepted by the latex <tt style='background-color: #f0f0e0;'>color</tt> packages. If it is of the form <tt style='background-color: #f0f0e0;'>#ff00ff</tt>, Maruku defines a color using the <tt style='background-color: #f0f0e0;'>\definecolor</tt> macro.</p><p>For example, for <tt style='background-color: #f0f0e0;'>#0000ff</tt>, the macro is called as:</p><pre class='tex' style='background-color: #f0f0e0;'>\definecolor{DummyName}{rgb}{0,0,1} </pre></li></ul></dd></dl><h3>Examples</h3><p>An example of this is the following:</p><pre style='background-color: #f0f0e0;'>@¬code_show_spaces;¬code_background_color:¬green
|
|
51
|
+
|
|
52
|
+
» ¬One¬space
|
|
53
|
+
» ¬¬Two¬spaces
|
|
54
|
+
» » ¬» Tab,¬space,¬tab
|
|
55
|
+
» » » » Tab,¬tab,¬tab¬and¬all¬is¬green!
|
|
56
|
+
</pre><p>That will produce:</p><pre style='background-color: green;'>¬One¬space
|
|
57
|
+
¬¬Two¬spaces
|
|
58
|
+
» ¬» Tab,¬space,¬tab
|
|
59
|
+
» » » Tab,¬tab,¬tab¬and¬all¬is¬green!
|
|
60
|
+
</pre><p>Example with css-style color:</p><pre style='background-color: #f0f0e0;'>@ code_background_color: #455678
|
|
61
|
+
|
|
62
|
+
A strange color
|
|
63
|
+
</pre><p>produces:</p><pre style='background-color: #455678;'>A strange color
|
|
64
|
+
</pre><p>Or highlighting (does not work well yet):</p><pre style='background-color: #f0f0e0;'>@ lang: xml
|
|
65
|
+
<div style="text-align:center">Div</div>
|
|
66
|
+
</pre><p>produces:</p><pre class='xml' style='background-color: #f0f0e0;'><span class='punct'><</span><span class='tag'>div</span> <span class='attribute'>style</span><span class='punct'>="</span><span class='string'>text-align:center</span><span class='punct'>"></span>Div<span class='punct'></</span><span class='tag'>div</span><span class='punct'>></span>
|
|
67
|
+
</pre><hr /><h2 id='future'>Future developments</h2><p>I think that <a href='http://sophos.berkeley.edu/macfarlane/pandoc/'>Pandoc</a> and <a href='http://fletcher.freeshell.org/wiki/MultiMarkdown'>MultiMarkdown</a> are very cool projects. However, they are written in Haskell and Perl, respectively. I would love to have an equivalent in Ruby.</p><h3 id='future-syntax'>Syntax improvements</h3><p>Things I'm thinking about:</p><ul><li><p>a syntax for commenting parts of the document:</p><pre style='background-color: #f0f0e0;'>This is a paragraph
|
|
68
|
+
% This is a comment</pre></li><li><p>choose a syntax for adding math:</p><pre style='background-color: #f0f0e0;'>This is inline math: $\alpha$
|
|
69
|
+
|
|
70
|
+
This is an equation with label:
|
|
71
|
+
|
|
72
|
+
$ \alpha = \beta + \gamma $ (eq:1)
|
|
73
|
+
|
|
74
|
+
This is a reference to equation: please see (eq:1)</pre></li></ul><div class='footnotes'><hr /><ol><li id='fn:1'><p>I really was missing those.<a href='#fnref:1' rev='footnote'>↩</a></p></li><li id='fn:2'><p>"a different philosophy" stands for "ugly" <tt style='background-color: #f0f0e0;'>:-)</tt><a href='#fnref:2' rev='footnote'>↩</a></p></li></ol></div></body></html>
|
data/docs/maruku.log
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4) (format=pdflatex 2005.12.27) 25 DEC 2006 16:35
|
|
2
|
+
entering extended mode
|
|
3
|
+
**./maruku
|
|
4
|
+
(./maruku.tex
|
|
5
|
+
LaTeX2e <2003/12/01>
|
|
6
|
+
Babel <v3.8d> and hyphenation patterns for american, french, german, ngerman, b
|
|
7
|
+
ahasa, basque, bulgarian, catalan, croatian, czech, danish, dutch, esperanto, e
|
|
8
|
+
stonian, finnish, greek, icelandic, irish, italian, latin, magyar, norsk, polis
|
|
9
|
+
h, portuges, romanian, russian, serbian, slovak, slovene, spanish, swedish, tur
|
|
10
|
+
kish, ukrainian, nohyphenation, loaded.
|
|
11
|
+
(/sw/share/texmf-dist/tex/latex/base/article.cls
|
|
12
|
+
Document Class: article 2004/02/16 v1.4f Standard LaTeX document class
|
|
13
|
+
(/sw/share/texmf-dist/tex/latex/base/size10.clo
|
|
14
|
+
File: size10.clo 2004/02/16 v1.4f Standard LaTeX file (size option)
|
|
15
|
+
)
|
|
16
|
+
\c@part=\count79
|
|
17
|
+
\c@section=\count80
|
|
18
|
+
\c@subsection=\count81
|
|
19
|
+
\c@subsubsection=\count82
|
|
20
|
+
\c@paragraph=\count83
|
|
21
|
+
\c@subparagraph=\count84
|
|
22
|
+
\c@figure=\count85
|
|
23
|
+
\c@table=\count86
|
|
24
|
+
\abovecaptionskip=\skip41
|
|
25
|
+
\belowcaptionskip=\skip42
|
|
26
|
+
\bibindent=\dimen102
|
|
27
|
+
)
|
|
28
|
+
(/sw/share/texmf-dist/tex/latex/listings/listings.sty
|
|
29
|
+
(/sw/share/texmf-dist/tex/latex/graphics/keyval.sty
|
|
30
|
+
Package: keyval 1999/03/16 v1.13 key=value parser (DPC)
|
|
31
|
+
\KV@toks@=\toks14
|
|
32
|
+
)
|
|
33
|
+
\lst@mode=\count87
|
|
34
|
+
\lst@gtempboxa=\box26
|
|
35
|
+
\lst@token=\toks15
|
|
36
|
+
\lst@length=\count88
|
|
37
|
+
\lst@currlwidth=\dimen103
|
|
38
|
+
\lst@column=\count89
|
|
39
|
+
\lst@pos=\count90
|
|
40
|
+
\lst@lostspace=\dimen104
|
|
41
|
+
\lst@width=\dimen105
|
|
42
|
+
\lst@newlines=\count91
|
|
43
|
+
\lst@lineno=\count92
|
|
44
|
+
\c@lstlisting=\count93
|
|
45
|
+
\lst@maxwidth=\dimen106
|
|
46
|
+
|
|
47
|
+
(/sw/share/texmf-dist/tex/latex/listings/lstpatch.sty
|
|
48
|
+
File: lstpatch.sty 2004/10/17 1.3b (Carsten Heinz)
|
|
49
|
+
)
|
|
50
|
+
(/sw/share/texmf-dist/tex/latex/listings/lstmisc.sty
|
|
51
|
+
File: lstmisc.sty 2004/09/07 1.3 (Carsten Heinz)
|
|
52
|
+
\c@lstnumber=\count94
|
|
53
|
+
\lst@skipnumbers=\count95
|
|
54
|
+
\lst@framebox=\box27
|
|
55
|
+
)
|
|
56
|
+
(/sw/share/texmf-dist/tex/latex/listings/listings.cfg
|
|
57
|
+
File: listings.cfg 2004/09/05 1.3 listings configuration
|
|
58
|
+
))
|
|
59
|
+
Package: listings 2004/10/17 1.3b (Carsten Heinz)
|
|
60
|
+
|
|
61
|
+
(/sw/share/texmf-dist/tex/latex/hyperref/hyperref.sty
|
|
62
|
+
Package: hyperref 2003/11/30 v6.74m Hypertext links for LaTeX
|
|
63
|
+
\@linkdim=\dimen107
|
|
64
|
+
\Hy@linkcounter=\count96
|
|
65
|
+
\Hy@pagecounter=\count97
|
|
66
|
+
|
|
67
|
+
(/sw/share/texmf-dist/tex/latex/hyperref/pd1enc.def
|
|
68
|
+
File: pd1enc.def 2003/11/30 v6.74m Hyperref: PDFDocEncoding definition (HO)
|
|
69
|
+
)
|
|
70
|
+
(/sw/share/texmf-dist/tex/latex/hyperref/hyperref.cfg
|
|
71
|
+
File: hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive and teTeX
|
|
72
|
+
)
|
|
73
|
+
Package hyperref Info: Hyper figures OFF on input line 1880.
|
|
74
|
+
Package hyperref Info: Link nesting OFF on input line 1885.
|
|
75
|
+
Package hyperref Info: Hyper index ON on input line 1888.
|
|
76
|
+
Package hyperref Info: Plain pages ON on input line 1893.
|
|
77
|
+
Package hyperref Info: Backreferencing OFF on input line 1900.
|
|
78
|
+
|
|
79
|
+
Implicit mode ON; LaTeX internals redefined
|
|
80
|
+
Package hyperref Info: Bookmarks ON on input line 2004.
|
|
81
|
+
(/sw/share/texmf-local/tex/latex/html/url.sty
|
|
82
|
+
Package: url 1999/03/02 ver 1.4 Verb mode for urls, email addresses, and file
|
|
83
|
+
names
|
|
84
|
+
)
|
|
85
|
+
LaTeX Info: Redefining \url on input line 2143.
|
|
86
|
+
\Fld@menulength=\count98
|
|
87
|
+
\Field@Width=\dimen108
|
|
88
|
+
\Fld@charsize=\dimen109
|
|
89
|
+
\Choice@toks=\toks16
|
|
90
|
+
\Field@toks=\toks17
|
|
91
|
+
Package hyperref Info: Hyper figures OFF on input line 2618.
|
|
92
|
+
Package hyperref Info: Link nesting OFF on input line 2623.
|
|
93
|
+
Package hyperref Info: Hyper index ON on input line 2626.
|
|
94
|
+
Package hyperref Info: backreferencing OFF on input line 2633.
|
|
95
|
+
Package hyperref Info: Link coloring OFF on input line 2638.
|
|
96
|
+
\c@Item=\count99
|
|
97
|
+
\c@Hfootnote=\count100
|
|
98
|
+
)
|
|
99
|
+
*hyperref using default driver hpdftex*
|
|
100
|
+
(/sw/share/texmf-dist/tex/latex/hyperref/hpdftex.def
|
|
101
|
+
File: hpdftex.def 2003/11/30 v6.74m Hyperref driver for pdfTeX
|
|
102
|
+
|
|
103
|
+
(/sw/share/texmf-dist/tex/latex/psnfss/pifont.sty
|
|
104
|
+
Package: pifont 2004/09/15 PSNFSS-v9.2 Pi font support (SPQR)
|
|
105
|
+
LaTeX Font Info: Try loading font information for U+pzd on input line 63.
|
|
106
|
+
|
|
107
|
+
(/sw/share/texmf-dist/tex/latex/psnfss/upzd.fd
|
|
108
|
+
File: upzd.fd 2001/06/04 font definitions for U/pzd.
|
|
109
|
+
)
|
|
110
|
+
LaTeX Font Info: Try loading font information for U+psy on input line 64.
|
|
111
|
+
|
|
112
|
+
(/sw/share/texmf-dist/tex/latex/psnfss/upsy.fd
|
|
113
|
+
File: upsy.fd 2001/06/04 font definitions for U/psy.
|
|
114
|
+
))
|
|
115
|
+
\Fld@listcount=\count101
|
|
116
|
+
\@outlinefile=\write3
|
|
117
|
+
)
|
|
118
|
+
(/sw/share/texmf-dist/tex/latex/graphics/color.sty
|
|
119
|
+
Package: color 1999/02/16 v1.0i Standard LaTeX Color (DPC)
|
|
120
|
+
|
|
121
|
+
(/sw/share/texmf-dist/tex/latex/graphics/color.cfg
|
|
122
|
+
File: color.cfg 2005/02/03 v1.3 color configuration of teTeX/TeXLive
|
|
123
|
+
)
|
|
124
|
+
Package color Info: Driver file: pdftex.def on input line 125.
|
|
125
|
+
|
|
126
|
+
(/sw/share/texmf-dist/tex/latex/graphics/pdftex.def
|
|
127
|
+
File: pdftex.def 2002/06/19 v0.03k graphics/color for pdftex
|
|
128
|
+
\Gread@gobject=\count102
|
|
129
|
+
)
|
|
130
|
+
(/sw/share/texmf-dist/tex/latex/graphics/dvipsnam.def
|
|
131
|
+
File: dvipsnam.def 1999/02/16 v3.0i Driver-dependant file (DPC,SPQR)
|
|
132
|
+
))
|
|
133
|
+
Package hyperref Info: Option `colorlinks' set `true' on input line 8.
|
|
134
|
+
(./maruku.aux)
|
|
135
|
+
\openout1 = `maruku.aux'.
|
|
136
|
+
|
|
137
|
+
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 9.
|
|
138
|
+
LaTeX Font Info: ... okay on input line 9.
|
|
139
|
+
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 9.
|
|
140
|
+
LaTeX Font Info: ... okay on input line 9.
|
|
141
|
+
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 9.
|
|
142
|
+
LaTeX Font Info: ... okay on input line 9.
|
|
143
|
+
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 9.
|
|
144
|
+
LaTeX Font Info: ... okay on input line 9.
|
|
145
|
+
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 9.
|
|
146
|
+
LaTeX Font Info: ... okay on input line 9.
|
|
147
|
+
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 9.
|
|
148
|
+
LaTeX Font Info: ... okay on input line 9.
|
|
149
|
+
LaTeX Font Info: Checking defaults for PD1/pdf/m/n on input line 9.
|
|
150
|
+
LaTeX Font Info: ... okay on input line 9.
|
|
151
|
+
Package hyperref Info: Link coloring ON on input line 9.
|
|
152
|
+
|
|
153
|
+
(/sw/share/texmf-dist/tex/latex/hyperref/nameref.sty
|
|
154
|
+
Package: nameref 2003/12/03 v2.21 Cross-referencing by name of section
|
|
155
|
+
\c@section@level=\count103
|
|
156
|
+
)
|
|
157
|
+
LaTeX Info: Redefining \ref on input line 9.
|
|
158
|
+
LaTeX Info: Redefining \pageref on input line 9.
|
|
159
|
+
(./maruku.out)
|
|
160
|
+
(./maruku.out)
|
|
161
|
+
\openout3 = `maruku.out'.
|
|
162
|
+
|
|
163
|
+
(/sw/share/texmf-dist/tex/context/base/supp-pdf.tex
|
|
164
|
+
(/sw/share/texmf-dist/tex/context/base/supp-mis.tex
|
|
165
|
+
loading : Context Support Macros / Miscellaneous (2004.10.26)
|
|
166
|
+
\protectiondepth=\count104
|
|
167
|
+
\scratchcounter=\count105
|
|
168
|
+
\scratchtoks=\toks18
|
|
169
|
+
\scratchdimen=\dimen110
|
|
170
|
+
\scratchskip=\skip43
|
|
171
|
+
\scratchmuskip=\muskip10
|
|
172
|
+
\scratchbox=\box28
|
|
173
|
+
\scratchread=\read1
|
|
174
|
+
\scratchwrite=\write4
|
|
175
|
+
\zeropoint=\dimen111
|
|
176
|
+
\onepoint=\dimen112
|
|
177
|
+
\onebasepoint=\dimen113
|
|
178
|
+
\minusone=\count106
|
|
179
|
+
\thousandpoint=\dimen114
|
|
180
|
+
\onerealpoint=\dimen115
|
|
181
|
+
\emptytoks=\toks19
|
|
182
|
+
\nextbox=\box29
|
|
183
|
+
\nextdepth=\dimen116
|
|
184
|
+
\everyline=\toks20
|
|
185
|
+
\!!counta=\count107
|
|
186
|
+
\!!countb=\count108
|
|
187
|
+
\recursecounter=\count109
|
|
188
|
+
)
|
|
189
|
+
loading : Context Support Macros / PDF (2004.03.26)
|
|
190
|
+
\nofMPsegments=\count110
|
|
191
|
+
\nofMParguments=\count111
|
|
192
|
+
\MPscratchCnt=\count112
|
|
193
|
+
\MPscratchDim=\dimen117
|
|
194
|
+
\MPnumerator=\count113
|
|
195
|
+
\everyMPtoPDFconversion=\toks21
|
|
196
|
+
)
|
|
197
|
+
LaTeX Font Info: Try loading font information for OMS+cmr on input line 46.
|
|
198
|
+
(/sw/share/texmf-dist/tex/latex/base/omscmr.fd
|
|
199
|
+
File: omscmr.fd 1999/05/25 v2.5h Standard LaTeX font definitions
|
|
200
|
+
)
|
|
201
|
+
LaTeX Font Info: Font shape `OMS/cmr/m/n' in size <10> not available
|
|
202
|
+
(Font) Font shape `OMS/cmsy/m/n' tried instead on input line 46.
|
|
203
|
+
|
|
204
|
+
(/sw/share/texmf-dist/tex/latex/listings/lstlang1.sty
|
|
205
|
+
File: lstlang1.sty 2004/09/05 1.3 listings language file
|
|
206
|
+
)
|
|
207
|
+
(/sw/share/texmf-dist/tex/latex/listings/lstlang2.sty
|
|
208
|
+
File: lstlang2.sty 2004/09/05 1.3 listings language file
|
|
209
|
+
) [1
|
|
210
|
+
|
|
211
|
+
{/Users/andrea/.texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
|
|
212
|
+
LaTeX Font Info: External font `cmex10' loaded for size
|
|
213
|
+
(Font) <7> on input line 168.
|
|
214
|
+
LaTeX Font Info: External font `cmex10' loaded for size
|
|
215
|
+
(Font) <5> on input line 168.
|
|
216
|
+
LaTeX Font Info: External font `cmex10' loaded for size
|
|
217
|
+
(Font) <8> on input line 175.
|
|
218
|
+
LaTeX Font Info: External font `cmex10' loaded for size
|
|
219
|
+
(Font) <6> on input line 175.
|
|
220
|
+
|
|
221
|
+
(/sw/share/texmf-dist/tex/latex/listings/lstlang1.sty
|
|
222
|
+
File: lstlang1.sty 2004/09/05 1.3 listings language file
|
|
223
|
+
)
|
|
224
|
+
(/sw/share/texmf-dist/tex/latex/listings/lstmisc.sty
|
|
225
|
+
File: lstmisc.sty 2004/09/07 1.3 (Carsten Heinz)
|
|
226
|
+
) [2]
|
|
227
|
+
LaTeX Font Info: Font shape `OT1/cmtt/bx/n' in size <8> not available
|
|
228
|
+
(Font) Font shape `OT1/cmtt/m/n' tried instead on input line 198.
|
|
229
|
+
[3] [4]
|
|
230
|
+
Overfull \hbox (12.2479pt too wide) in paragraph at lines 414--415
|
|
231
|
+
[]\OT1/cmr/m/n/10 for \OT1/cmr/bx/n/10 HTML out-put\OT1/cmr/m/n/10 , the value
|
|
232
|
+
is put straight in the [][][][][][]
|
|
233
|
+
[]
|
|
234
|
+
|
|
235
|
+
(/sw/share/texmf-dist/tex/latex/listings/lstlang1.sty
|
|
236
|
+
File: lstlang1.sty 2004/09/05 1.3 listings language file
|
|
237
|
+
)
|
|
238
|
+
(/sw/share/texmf-dist/tex/latex/listings/lstlang2.sty
|
|
239
|
+
File: lstlang2.sty 2004/09/05 1.3 listings language file
|
|
240
|
+
)
|
|
241
|
+
(/sw/share/texmf-dist/tex/latex/listings/lstlang3.sty
|
|
242
|
+
File: lstlang3.sty 2004/09/05 1.3 listings language file
|
|
243
|
+
)
|
|
244
|
+
(/sw/share/texmf-dist/tex/latex/listings/lstlang1.sty
|
|
245
|
+
File: lstlang1.sty 2004/09/05 1.3 listings language file
|
|
246
|
+
)
|
|
247
|
+
(/sw/share/texmf-dist/tex/latex/listings/lstlang2.sty
|
|
248
|
+
File: lstlang2.sty 2004/09/05 1.3 listings language file
|
|
249
|
+
)
|
|
250
|
+
(/sw/share/texmf-dist/tex/latex/listings/lstlang3.sty
|
|
251
|
+
File: lstlang3.sty 2004/09/05 1.3 listings language file
|
|
252
|
+
)
|
|
253
|
+
(/sw/share/texmf-dist/tex/latex/listings/lstlang1.sty
|
|
254
|
+
File: lstlang1.sty 2004/09/05 1.3 listings language file
|
|
255
|
+
)
|
|
256
|
+
(/sw/share/texmf-dist/tex/latex/listings/lstlang2.sty
|
|
257
|
+
File: lstlang2.sty 2004/09/05 1.3 listings language file
|
|
258
|
+
)
|
|
259
|
+
(/sw/share/texmf-dist/tex/latex/listings/lstlang3.sty
|
|
260
|
+
File: lstlang3.sty 2004/09/05 1.3 listings language file
|
|
261
|
+
)
|
|
262
|
+
(/sw/share/texmf-dist/tex/latex/listings/lstmisc.sty
|
|
263
|
+
File: lstmisc.sty 2004/09/07 1.3 (Carsten Heinz)
|
|
264
|
+
) [5]
|
|
265
|
+
(/sw/share/texmf-dist/tex/latex/listings/lstlang1.sty
|
|
266
|
+
File: lstlang1.sty 2004/09/05 1.3 listings language file
|
|
267
|
+
) [6] [7] (./maruku.aux) )
|
|
268
|
+
Here is how much of TeX's memory you used:
|
|
269
|
+
5376 strings out of 94500
|
|
270
|
+
74269 string characters out of 1176113
|
|
271
|
+
168877 words of memory out of 1000000
|
|
272
|
+
8372 multiletter control sequences out of 10000+50000
|
|
273
|
+
8353 words of font info for 30 fonts, out of 500000 for 2000
|
|
274
|
+
580 hyphenation exceptions out of 1000
|
|
275
|
+
39i,8n,77p,529b,1962s stack positions out of 1500i,500n,5000p,200000b,5000s
|
|
276
|
+
PDF statistics:
|
|
277
|
+
222 PDF objects out of 300000
|
|
278
|
+
137 named destinations out of 131072
|
|
279
|
+
17 words of extra memory for PDF output out of 65536
|
|
280
|
+
|
|
281
|
+
! pdfTeX warning (dest): name{future-export} has been referenced but does not e
|
|
282
|
+
xist, replaced by a fixed one
|
|
283
|
+
|
|
284
|
+
! pdfTeX warning (dest): name{usage} has been referenced but does not exist, re
|
|
285
|
+
placed by a fixed one
|
|
286
|
+
|
|
287
|
+
</sw/share/texmf-dist/fonts/type1/bluesky/cm/cmr8.pfb></sw/share/texmf-dist/fon
|
|
288
|
+
ts/type1/bluesky/cm/cmr6.pfb></sw/share/texmf-dist/fonts/type1/bluesky/cm/cmr7.
|
|
289
|
+
pfb></sw/share/texmf-dist/fonts/type1/bluesky/cm/cmtt10.pfb></sw/share/texmf-di
|
|
290
|
+
st/fonts/type1/bluesky/cm/cmtt8.pfb></sw/share/texmf-dist/fonts/type1/bluesky/c
|
|
291
|
+
m/cmbx10.pfb></sw/share/texmf-dist/fonts/type1/bluesky/cm/cmsy10.pfb></sw/share
|
|
292
|
+
/texmf-dist/fonts/type1/bluesky/cm/cmti10.pfb></sw/share/texmf-dist/fonts/type1
|
|
293
|
+
/bluesky/cm/cmr10.pfb></sw/share/texmf-dist/fonts/type1/bluesky/cm/cmbx12.pfb>
|
|
294
|
+
Output written on maruku.pdf (7 pages, 119358 bytes).
|
data/docs/maruku.md
ADDED
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
Title: Maruku, a Markdown interpreter
|
|
2
|
+
CSS: style.css
|
|
3
|
+
latex_use_listings: true
|
|
4
|
+
html_use_syntax: true
|
|
5
|
+
|
|
6
|
+
Mar**u**k**u**: a Markdown interpreter
|
|
7
|
+
======================================
|
|
8
|
+
|
|
9
|
+
Maruku is a Markdown interpreter written in [Ruby][].
|
|
10
|
+
|
|
11
|
+
Maruku allows you to write in an easy-to-read-and-write syntax, like this:
|
|
12
|
+
|
|
13
|
+
> [This document in Markdown](http://maruku.rubyforge.org/maruku.md)
|
|
14
|
+
|
|
15
|
+
Then it can be translated to HTML:
|
|
16
|
+
|
|
17
|
+
> [This document in HTML](http://maruku.rubyforge.org/maruku.html)
|
|
18
|
+
|
|
19
|
+
or Latex, which is then converted to PDF:
|
|
20
|
+
|
|
21
|
+
> [This document in PDF](http://maruku.rubyforge.org/maruku.pdf)
|
|
22
|
+
|
|
23
|
+
Maruku implements the original [Markdown syntax][]
|
|
24
|
+
([HTML](http://maruku.rubyforge.org/markdown_syntax.html) or
|
|
25
|
+
[PDF](http://maruku.rubyforge.org/markdown_syntax.pdf), translated by Maruku).
|
|
26
|
+
|
|
27
|
+
Markdown implements also all the improvements
|
|
28
|
+
in [PHP Markdown Extra][].
|
|
29
|
+
|
|
30
|
+
Moreover, it implements ideas from [MultiMarkdown][].
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
* * *
|
|
34
|
+
|
|
35
|
+
*Table of contents*:
|
|
36
|
+
|
|
37
|
+
* [Download](#download)
|
|
38
|
+
* [Usage](#usage)
|
|
39
|
+
* [Examples of PHP Markdown extra syntax](#extra)
|
|
40
|
+
* [New metadata syntax](#meta)
|
|
41
|
+
* [List of metadata](#metalist)
|
|
42
|
+
* [Maruku and Bluecloth](#maruku-and-bluecloth)
|
|
43
|
+
* [Future developments](#future)
|
|
44
|
+
* [Export to other formats](#future-export)
|
|
45
|
+
* [Syntax additions](#future-syntax)
|
|
46
|
+
|
|
47
|
+
* * *
|
|
48
|
+
|
|
49
|
+
@ class: head
|
|
50
|
+
|
|
51
|
+
Download {#download}
|
|
52
|
+
--------
|
|
53
|
+
|
|
54
|
+
The development site is <http://maruku.rubyforge.net/>.
|
|
55
|
+
|
|
56
|
+
Download current [gem][] at <http://maruku.rubyforge.net/gem1.0>
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
[gem]: http://rubygems.rubyforge.org/
|
|
60
|
+
|
|
61
|
+
Usage
|
|
62
|
+
--------
|
|
63
|
+
|
|
64
|
+
This is the basic usage:
|
|
65
|
+
|
|
66
|
+
@ lang: ruby
|
|
67
|
+
|
|
68
|
+
require 'maruku'
|
|
69
|
+
|
|
70
|
+
doc = Maruku.new(markdown_string)
|
|
71
|
+
puts doc.to_html
|
|
72
|
+
|
|
73
|
+
or, if you install through RubyGems,
|
|
74
|
+
|
|
75
|
+
@ lang: ruby
|
|
76
|
+
require 'rubygems'
|
|
77
|
+
require 'maruku'
|
|
78
|
+
|
|
79
|
+
This outputs a complete XHTML 1.0 document:
|
|
80
|
+
|
|
81
|
+
@ lang: ruby
|
|
82
|
+
|
|
83
|
+
puts doc.to_html_document
|
|
84
|
+
|
|
85
|
+
You can have the REXML document tree with:
|
|
86
|
+
|
|
87
|
+
@ lang: ruby
|
|
88
|
+
|
|
89
|
+
tree = doc.to_html_document_tree
|
|
90
|
+
|
|
91
|
+
### From the command line ###
|
|
92
|
+
|
|
93
|
+
There are two command-line programs installed: `maruku` and `marutex`
|
|
94
|
+
|
|
95
|
+
`maruku` converts Markdown in HTML:
|
|
96
|
+
|
|
97
|
+
$ maruku file.md # creates file.html
|
|
98
|
+
|
|
99
|
+
`marutex` converts Markdown in TeX, then calls `pdflatex` to
|
|
100
|
+
transform to PDF:
|
|
101
|
+
|
|
102
|
+
$ marutex file.md # creates file.tex and file.pdf
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
Examples of PHP Markdown Extra syntax {#extra}
|
|
106
|
+
-------------------------------------
|
|
107
|
+
|
|
108
|
+
* tables
|
|
109
|
+
|
|
110
|
+
Col1 | Very very long head | Very very long head|
|
|
111
|
+
-----|:-------------------:|-------------------:|
|
|
112
|
+
cell | center-align | right-align |
|
|
113
|
+
|
|
114
|
+
@ class: example
|
|
115
|
+
|
|
116
|
+
Col1 | Very very long head | Very very long head|
|
|
117
|
+
-----|:-------------------:|-------------------:|
|
|
118
|
+
cell | center-align | right-align |
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
* footnotes [^foot]
|
|
122
|
+
|
|
123
|
+
*footnotes [^foot]
|
|
124
|
+
|
|
125
|
+
[^foot]: I really was missing those.
|
|
126
|
+
|
|
127
|
+
[^foot]: I really was missing those.
|
|
128
|
+
|
|
129
|
+
* Markdown inside HTML elememnts
|
|
130
|
+
|
|
131
|
+
@lang: html
|
|
132
|
+
|
|
133
|
+
<div markdown="1" style="border: solid 1px black">
|
|
134
|
+
This is a div with Markdown **strong text**
|
|
135
|
+
</div>
|
|
136
|
+
|
|
137
|
+
<div markdown="1" style="border: solid 1px black">
|
|
138
|
+
This is a div with Markdown **strong text**
|
|
139
|
+
</div>
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
* header ids
|
|
143
|
+
## Header ## {#id}
|
|
144
|
+
For example, [a link to the download](#download) header.
|
|
145
|
+
|
|
146
|
+
* definition lists
|
|
147
|
+
|
|
148
|
+
Definition list
|
|
149
|
+
: something very hard to parse
|
|
150
|
+
|
|
151
|
+
Definition list
|
|
152
|
+
: something very hard to parse
|
|
153
|
+
|
|
154
|
+
* abbreviations or ABB for short.
|
|
155
|
+
|
|
156
|
+
*[ABB]: Simple an abbreviation
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
Maruku and Bluecloth {#maruku-and-bluecloth}
|
|
161
|
+
--------------------
|
|
162
|
+
|
|
163
|
+
The other Ruby implementation of Markdown is [Bluecloth][].
|
|
164
|
+
|
|
165
|
+
Maruku is much different in philosophy from Bluecloth: the biggest
|
|
166
|
+
difference is that *parsing* is separated from *rendering*.
|
|
167
|
+
In Maruku, an in-memory representation of the Markdown
|
|
168
|
+
document is created. Instead, Bluecloth mantains the document in
|
|
169
|
+
memory as a String at all times, and does a series of `gsub`
|
|
170
|
+
to transform to HTML.[^1]
|
|
171
|
+
|
|
172
|
+
[^1]: "a different philosophy" stands for "ugly" `:-)`
|
|
173
|
+
|
|
174
|
+
The in-memory representation makes it very easy to export
|
|
175
|
+
to various formats (altough, for, now)
|
|
176
|
+
|
|
177
|
+
Other improvements over Bluecloth:
|
|
178
|
+
|
|
179
|
+
* the HTML output is provided also as a `REXML` document tree.
|
|
180
|
+
|
|
181
|
+
* PHP Markdown Syntax support.
|
|
182
|
+
|
|
183
|
+
[ruby]: http://www.ruby-lang.org
|
|
184
|
+
[bluecloth]: http://www.deveiate.org/projects/BlueCloth
|
|
185
|
+
[Markdown syntax]: http://daringfireball.net/projects/markdown/syntax
|
|
186
|
+
[PHP Markdown Extra]: http://www.michelf.com/projects/php-markdown/extra/
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
New meta-data syntax {#meta}
|
|
190
|
+
--------------------
|
|
191
|
+
|
|
192
|
+
Maruku implements a syntax that allows to attach "meta" information
|
|
193
|
+
to objects.
|
|
194
|
+
|
|
195
|
+
### Meta-data for the document ###
|
|
196
|
+
|
|
197
|
+
Meta-data for the document itself is specified through the use
|
|
198
|
+
of email headers:
|
|
199
|
+
|
|
200
|
+
Title: A simple document containing meta-headers
|
|
201
|
+
CSS: style.css
|
|
202
|
+
|
|
203
|
+
Content of the document
|
|
204
|
+
|
|
205
|
+
When creating the document through
|
|
206
|
+
|
|
207
|
+
@ lang: ruby
|
|
208
|
+
|
|
209
|
+
Maruku.new(s).to_html_document
|
|
210
|
+
|
|
211
|
+
the title and stylesheet are added as expected.
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
### Meta-data for elements ###
|
|
215
|
+
|
|
216
|
+
Maruku introduces a new syntax for attaching metadata to paragraphs, tables, and
|
|
217
|
+
so on.
|
|
218
|
+
|
|
219
|
+
For example, consider the creation of two paragraphs:
|
|
220
|
+
|
|
221
|
+
Paragraph 1 is a warning.
|
|
222
|
+
|
|
223
|
+
Paragraph 2
|
|
224
|
+
|
|
225
|
+
Now you really want to attach a 'class' attribute to the paragraphs (for
|
|
226
|
+
example for CSS styling). Maruku allows you to use:
|
|
227
|
+
|
|
228
|
+
@ class: warning
|
|
229
|
+
Paragraph 1 is a warning
|
|
230
|
+
|
|
231
|
+
Paragraph 2
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
You can add more by separating with a `;`:
|
|
235
|
+
|
|
236
|
+
@ class: warning; id: warning1
|
|
237
|
+
Paragraph 1 is a warning
|
|
238
|
+
|
|
239
|
+
A meta-data declaration is composed of
|
|
240
|
+
|
|
241
|
+
1. newline
|
|
242
|
+
2. an at-symbol '@'
|
|
243
|
+
3. a series of name-value pairs. Each name-value is separated
|
|
244
|
+
by a colon `:`, pairs are separated by semi-colons `;`
|
|
245
|
+
|
|
246
|
+
Many declaration can be used, and they refer to _the following_ object:
|
|
247
|
+
|
|
248
|
+
@ class: warning
|
|
249
|
+
@ id: warning1
|
|
250
|
+
Paragraph 1 is a warning
|
|
251
|
+
|
|
252
|
+
These can also be separated by newlines:
|
|
253
|
+
|
|
254
|
+
@ class: warning
|
|
255
|
+
|
|
256
|
+
@ id: warning1
|
|
257
|
+
|
|
258
|
+
Paragraph 1 is a warning
|
|
259
|
+
|
|
260
|
+
Also, if the value is not present, it defaults to `true`:
|
|
261
|
+
|
|
262
|
+
@ test
|
|
263
|
+
|
|
264
|
+
This paragraph has the attribute 'test' set.
|
|
265
|
+
|
|
266
|
+
* * *
|
|
267
|
+
|
|
268
|
+
List of meta-data {#metalist}
|
|
269
|
+
-----------------
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
**`title`, `subject`**
|
|
274
|
+
: (document) Sets the title of the document use in `title` element.
|
|
275
|
+
|
|
276
|
+
**`css`**
|
|
277
|
+
: (document, HTML) Url of stylesheet.
|
|
278
|
+
|
|
279
|
+
**`latex_use_syntax`**
|
|
280
|
+
: (document, HTML) Use the [`syntax` library][syntax] to add source highlighting.
|
|
281
|
+
|
|
282
|
+
[syntax]: http://syntax.rubyforge.org/
|
|
283
|
+
|
|
284
|
+
**`latex_use_listings`**
|
|
285
|
+
: (document, LaTex) Use fancy `listing` package for better displaying code blocks.
|
|
286
|
+
|
|
287
|
+
**`style`, `id`, `class`**
|
|
288
|
+
: (any block object, HTML) Standard CSS attributes are copied.
|
|
289
|
+
|
|
290
|
+
**`lang`**
|
|
291
|
+
: (code blocks) Name of programming language (`ruby`) for syntax highlighting (does not work yet)
|
|
292
|
+
|
|
293
|
+
Default for this is `code_lang` in document.
|
|
294
|
+
|
|
295
|
+
**`code_show_spaces`**
|
|
296
|
+
: Shows tabs and newlines (default is read in the document object).
|
|
297
|
+
|
|
298
|
+
**`code_background_color`**
|
|
299
|
+
: Background color for code blocks. (default is read in the document object).
|
|
300
|
+
|
|
301
|
+
The format is either a named color (`green`, `red`) or a CSS color
|
|
302
|
+
of the form `#ff00ff`.
|
|
303
|
+
|
|
304
|
+
* for **HTML output**, the value is put straight in the `background-color` CSS
|
|
305
|
+
property of the block.
|
|
306
|
+
|
|
307
|
+
* for **LaTeX output**, if it is a named color, it must be a color accepted
|
|
308
|
+
by the latex `color` packages. If it is of the form `#ff00ff`, Maruku
|
|
309
|
+
defines a color using the `\definecolor` macro.
|
|
310
|
+
|
|
311
|
+
For example, for `#0000ff`, the macro is called as:
|
|
312
|
+
|
|
313
|
+
@ lang: tex
|
|
314
|
+
\definecolor{DummyName}{rgb}{0,0,1}
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
### Examples ###
|
|
318
|
+
|
|
319
|
+
An example of this is the following:
|
|
320
|
+
|
|
321
|
+
@ code_show_spaces
|
|
322
|
+
@ code_show_spaces; code_background_color: green
|
|
323
|
+
|
|
324
|
+
One space
|
|
325
|
+
Two spaces
|
|
326
|
+
Tab, space, tab
|
|
327
|
+
Tab, tab, tab and all is green!
|
|
328
|
+
|
|
329
|
+
That will produce:
|
|
330
|
+
|
|
331
|
+
@ code_show_spaces
|
|
332
|
+
@ code_background_color: green
|
|
333
|
+
|
|
334
|
+
One space
|
|
335
|
+
Two spaces
|
|
336
|
+
Tab, space, tab
|
|
337
|
+
Tab, tab, tab and all is green!
|
|
338
|
+
|
|
339
|
+
Example with css-style color:
|
|
340
|
+
|
|
341
|
+
@ code_background_color: #455678
|
|
342
|
+
|
|
343
|
+
A strange color
|
|
344
|
+
|
|
345
|
+
produces:
|
|
346
|
+
|
|
347
|
+
@ code_background_color: #455678
|
|
348
|
+
|
|
349
|
+
A strange color
|
|
350
|
+
|
|
351
|
+
Or highlighting (does not work well yet):
|
|
352
|
+
|
|
353
|
+
@ lang: xml
|
|
354
|
+
<div style="text-align:center">Div</div>
|
|
355
|
+
|
|
356
|
+
produces:
|
|
357
|
+
|
|
358
|
+
@ lang: xml
|
|
359
|
+
<div style="text-align:center">Div</div>
|
|
360
|
+
|
|
361
|
+
* * *
|
|
362
|
+
|
|
363
|
+
Future developments {#future}
|
|
364
|
+
-------------------
|
|
365
|
+
|
|
366
|
+
I think that [Pandoc][] and [MultiMarkdown][] are very cool projects.
|
|
367
|
+
However, they are written in Haskell and Perl, respectively.
|
|
368
|
+
I would love to have an equivalent in Ruby.
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
### Syntax improvements ### {#future-syntax}
|
|
372
|
+
|
|
373
|
+
Things I'm thinking about:
|
|
374
|
+
|
|
375
|
+
* a syntax for commenting parts of the document:
|
|
376
|
+
|
|
377
|
+
This is a paragraph
|
|
378
|
+
% This is a comment
|
|
379
|
+
|
|
380
|
+
* choose a syntax for adding math:
|
|
381
|
+
|
|
382
|
+
This is inline math: $\alpha$
|
|
383
|
+
|
|
384
|
+
This is an equation with label:
|
|
385
|
+
|
|
386
|
+
$ \alpha = \beta + \gamma $ (eq:1)
|
|
387
|
+
|
|
388
|
+
This is a reference to equation: please see (eq:1)
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
[Pandoc]: http://sophos.berkeley.edu/macfarlane/pandoc/
|
|
393
|
+
[MultiMarkdown]: http://fletcher.freeshell.org/wiki/MultiMarkdown
|
|
394
|
+
|