docs/maruku.html in maruku-0.4.2.1 vs docs/maruku.html in maruku-0.5.0

- old
+ new

@@ -1,17 +1,21 @@ -<?xml version='1.0' encoding='utf-8'?> -<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' -'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'> -<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'><head><meta content='text/html; charset=utf-8' http-equiv='Content-type' /><title>Maruku: a Markdown-superset interpreter</title><link href='style.css' rel='stylesheet' type='text/css' /></head><body> -<p><img src='logo.png' id='logo' /></p> +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE html PUBLIC + "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" + "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"> +<html xmlns:svg='http://www.w3.org/2000/svg' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'> +<head><meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' /><title>Maruku: a Markdown-superset interpreter</title><link href='style.css' rel='stylesheet' type='text/css' /> +</head> +<body> +<p><img src='logo.png' id='logo' alt='' /></p> <h1 id='maruku_a_markdownsuperset_interpreter'>Mar<strong>u</strong>k<strong>u</strong>: a Markdown-superset interpreter</h1> <p><a href='http://maruku.rubyforge.org/'>Maruku</a> is a Markdown interpreter written in <a href='http://www.ruby-lang.org'>Ruby</a>.</p> <blockquote id='news'> -<p><a href='#release_notes'>Last release</a> is version 0.4.2 &ndash; 2007-01-12.</p> +<p><a href='#release_notes'>Last release</a> is version 0.5.0 &#8211; 2007-01-23.</p> <p>Use this command to update:</p> <pre><code>$ gem update maruku</code></pre></blockquote> <hr /> <p>Maruku allows you to write in an easy-to-read-and-write syntax, like this:</p> @@ -48,260 +52,202 @@ </li> </ul> <p><strong>Authors</strong>: Maruku has been developed so far by <a href='http://www.dis.uniroma1.it/~acensi/'>Andrea Censi</a>. Contributors are most welcome!</p> -<p><strong>The name of the game</strong>: Maruku is the <a href='http://en.wikipedia.org/wiki/Romaji'>romaji</a> transliteration of the <a href='http://en.wikipedia.org/wiki/Katakana'>katakana</a> transliteration of &ldquo;Mark&rdquo;, the first word in Markdown. I chose this name because Ruby is Japanese, and also the sillable &ldquo;ru&rdquo; appears in Maruku.</p> +<p><strong>The name of the game</strong>: Maruku is the <a href='http://en.wikipedia.org/wiki/Romaji'>romaji</a> transliteration of the <a href='http://en.wikipedia.org/wiki/Katakana'>katakana</a> transliteration of &#8220;Mark&#8221;, the first word in Markdown. I chose this name because Ruby is Japanese, and also the sillable &#8220;ru&#8221; appears in Maruku.</p> <hr /> <p>Table of contents: (<strong>auto-generated by Maruku!</strong>)</p> -<div class='maruku_toc'><ul style='list-style: none;'><li><span class='maruku_section_number'>1. </span><a href='#release_notes'>Release notes</a></li><li><span class='maruku_section_number'>2. </span><a href='#download'>Download</a><ul style='list-style: none;'><li><span class='maruku_section_number'>2.1. </span><a href='#bugs_report'>Bugs report</a></li></ul></li><li><span class='maruku_section_number'>3. </span><a href='#usage'>Usage</a><ul style='list-style: none;'><li><span class='maruku_section_number'>3.1. </span><a href='#from_the_command_line'>From the command line</a></li></ul></li><li><span class='maruku_section_number'>4. </span><a href='#extra'>Examples of PHP Markdown Extra syntax</a></li><li><span class='maruku_section_number'>5. </span><a href='#maruku-and-bluecloth'>Maruku and Bluecloth</a></li><li><span class='maruku_section_number'>6. </span><a href='#meta'>New meta-data syntax</a><ul style='list-style: none;'><li><span class='maruku_section_number'>6.1. </span><a href='#metadata_for_blocklevel_and_spanlevel_elements'>Meta-data for block-level and span-level elements</a></li><li><span class='maruku_section_number'>6.2. </span><a href='#metadata_for_the_document'>Meta-data for the document</a></li><li><span class='maruku_section_number'>6.3. </span><a href='#metalist'>List of meta-data</a></li><li><span class='maruku_section_number'>6.4. </span><a href='#examples'>Examples</a></li></ul></li><li><span class='maruku_section_number'>7. </span><a href='#features'>Other Features</a><ul style='list-style: none;'><li><span class='maruku_section_number'>7.1. </span><a href='#automatic_generation_of_the_table_of_contents'>Automatic generation of the table of contents</a></li><li><span class='maruku_section_number'>7.2. </span><a href='#this_header_contains_emphasis_strong_text_and_'>This header contains <em>emphasis</em> <strong>strong text</strong> and <code>code</code></a></li><li><span class='maruku_section_number'>7.3. </span><a href='#use_html_entities'>Use HTML entities</a></li></ul></li><li><span class='maruku_section_number'>8. </span><a href='#future'>Future developments</a><ul style='list-style: none;'><li><span class='maruku_section_number'>8.1. </span><a href='#a_syntax_for_adding_math'>A syntax for adding math</a></li></ul></li></ul></div><hr /> +<div class='maruku_toc'><ul style='list-style: none;'><li><span class='maruku_section_number'>1. </span><a href='#release_notes'>Release notes</a></li><li><span class='maruku_section_number'>2. </span><a href='#download'>Download</a><ul style='list-style: none;'><li><span class='maruku_section_number'>2.1. </span><a href='#bugs_report'>Bugs report</a></li></ul></li><li><span class='maruku_section_number'>3. </span><a href='#usage'>Usage</a><ul style='list-style: none;'><li><span class='maruku_section_number'>3.1. </span><a href='#embedded_maruku'>Embedded Maruku</a></li><li><span class='maruku_section_number'>3.2. </span><a href='#from_the_command_line'>From the command line</a></li></ul></li><li><span class='maruku_section_number'>4. </span><a href='#maruku-and-bluecloth'>Maruku and Bluecloth</a></li><li><span class='maruku_section_number'>5. </span><a href='#maruku_summary_of_features'>Maruku summary of features</a><ul style='list-style: none;'><li><span class='maruku_section_number'>5.1. </span><a href='#meta'>New meta-data syntax</a></li><li><span class='maruku_section_number'>5.2. </span><a href='#toc-generation'>Automatic generation of the table of contents</a></li><li><span class='maruku_section_number'>5.3. </span><a href='#entities'>Use HTML entities</a></li><li><span class='maruku_section_number'>5.4. </span><a href='#this_header_contains_emphasis_strong_text_and_'>This header contains <em>emphasis</em> <strong>strong text</strong> and <code>code</code></a></li></ul></li><li><span class='maruku_section_number'>6. </span><a href='#extra'>Examples of PHP Markdown Extra syntax</a></li></ul></div><hr /> <h2 id='release_notes'><span class='maruku_section_number'>1. </span>Release notes</h2> <p>Note: Maruku seems to be very robust, nevertheless it is still beta-level software. So if you want to use it in production environments, please check back in a month or so, while we squash the remaining bugs.</p> <p>In the meantime, feel free to toy around, and please signal problems, request features, by <a href='http://www.dis.uniroma1.it/~acensi/contact.html'>contacting me</a> or using the <a href='http://rubyforge.org/tracker/?group_id=2795'>tracker</a>. For issues about the Markdown syntax itself and improvements to it, please write to the <a href='http://six.pairlist.net/mailman/listinfo/markdown-discuss'>Markdown-discuss mailing list</a>.</p> <p>Have fun!</p> -<h4 id='last'>Changes in 0.4.2</h4> +<p>See the <a href='http://maruku.rubyforge.org/changelog.html#stable'>changelog</a>.</p> -<ul> -<li> -<p>Adapted syntax to the <a href='http://maruku.rubyforge.org/proposal.html'>new meta-data proposal</a>.</p> -</li> +<h2 id='download'><span class='maruku_section_number'>2. </span>Download</h2> -<li> -<p>Changes in LaTeX export:</p> +<p>The development site is <a href='http://rubyforge.org/projects/maruku/'>http://rubyforge.org/projects/maruku/</a>.</p> -<ul> -<li> -<p>Links to external URLs are blue by default.</p> -</li> +<p>Install with:</p> +<pre><code>$ gem install maruku +</code></pre> +<p>Released files can also be seen at <a href='http://rubyforge.org/frs/?group_id=2795'>http://rubyforge.org/frs/?group_id=2795</a>.</p> -<li> -<p>New attributes: <code>latex_preamble</code> to add a custom preamble, and <code>latex_cjk</code> to add packages for UTF-8 Japanese characters. (<strong>support for this is still shaky</strong>). Example:</p> -<pre><code>Title: my document -LaTeX CJK: true -LaTeX preamble: preamble.tex +<p>Anonymous access to the repository is possible with:</p> +<pre><code>$ svn checkout svn://rubyforge.org/var/svn/maruku/trunk +</code></pre> +<p>If you want commit access to the repository, just create an account on Rubyforge and <a href='http://www.dis.uniroma1.it/~acensi/contact.html'>drop me a mail</a>.</p> -Content</code></pre></li> -</ul> -</li> +<h3 id='bugs_report'><span class='maruku_section_number'>2.1. </span>Bugs report</h3> -<li> -<p>Bug fixes</p> +<p>Use the <a href='http://rubyforge.org/tracker/?group_id=2795'>tracker</a> or <a href='http://www.dis.uniroma1.it/~acensi/contact.html'>drop me an email</a>.</p> -<ul> -<li> -<p>Images were not given <code>id</code> or <code>class</code> attributes.</p> -</li> +<h2 id='usage'><span class='maruku_section_number'>3. </span>Usage</h2> -<li> -<p>Fixed bug in LaTeX export with handling of <code>&lt;</code>,<code>&gt;</code> enclosed URLs: <code>&lt;google.com&gt;</code>.</p> -</li> -</ul> -</li> -</ul> +<h3 id='embedded_maruku'><span class='maruku_section_number'>3.1. </span>Embedded Maruku</h3> -<h4 id='changes_in_041_aka_typographer'>Changes in 0.4.1 aka &ldquo;Typographer&rdquo;</h4> +<p>This is the basic usage:</p> +<pre><code>require &#39;rubygems&#39; +require &#39;maruku&#39; -<ul> -<li> -<p>Implemented SmartyPants support:</p> -<pre><code>&#39;Twas a &quot;test&quot; to &#39;remember&#39; -- in the &#39;90s ---- while I was &lt;&lt;ok&gt;&gt;. She was 6\&quot;12\&#39;.</code></pre> -<blockquote> -<p>&lsquo;Twas a &ldquo;test&rdquo; to &lsquo;remember&rsquo; &ndash; in the &rsquo;90s &mdash; while I was &laquo;ok&raquo;. She was 6&quot;12&#39;.</p> -</blockquote> +doc = Maruku.new(markdown_string) +puts doc.to_html +</code></pre> +<p>The method <code>to_html</code> outputs only an HTML fragment, while the method <code>to_html_document</code> outputs a complete XHTML 1.0 document:</p> +<pre><code>puts doc.to_html_document +</code></pre> +<p>You can have the REXML document tree with:</p> +<pre><code>tree = doc.to_html_document_tree +</code></pre> +<h3 id='from_the_command_line'><span class='maruku_section_number'>3.2. </span>From the command line</h3> -<p>I adapted the code from RubyPants.</p> -</li> +<p>There is one command-line program installed: <code>maruku</code>.</p> -<li> -<p>Server directives between <code>&lt;? ?&gt;</code> are properly preserved.</p> -</li> +<p>Without arguments, it converts Markdown to HTML:</p> +<pre><code>$ maruku file.md # creates file.html</code></pre> +<p>With the <code>--pdf</code> arguments, it converts Markdown to LaTeX, then calls <code>pdflatex</code> to transform to PDF:</p> +<pre><code>$ maruku --pdf file.md # creates file.tex and file.pdf</code></pre> +<h2 id='maruku-and-bluecloth'><span class='maruku_section_number'>4. </span>Maruku and Bluecloth</h2> -<li> -<p>Changes in LaTeX export:</p> +<p>The other Ruby implementation of Markdown is <a href='http://www.deveiate.org/projects/BlueCloth'>Bluecloth</a>.</p> -<ul> -<li> -<p>Now Japanese text rendering sort of works, using the following packages:</p> -<pre><code>\usepackage[C40]{fontenc} -\usepackage[cjkjis]{ucs} -\usepackage[utf8x]{inputenc} -</code></pre> -<p>Nevertheless, I could only get bitmap fonts working &ndash; probably it&rsquo;s a problem with my setup.</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 <code>gsub</code> to transform to HTML.</p> -<p>A quick test: 日本、中国、ひらがな、カタカナ。</p> -</li> +<p>Maruku is usually faster than Bluecloth. Bluecloth is faster for very small documents. Bluecloth sometimes chokes on very big documents (it is reported that the blame should be on Ruby&#8217;s regexp implementation).</p> -<li> -<p>Fixed bugs in rendering of immediate links.</p> -</li> +<p>This is the canonical benchmark (the Markdown specification), executed with Ruby 1.8.5 on a Powerbook 1.5GhZ:</p> +<pre><code>BlueCloth (to_html): parsing 0.01 sec + rendering 1.87 sec = 1.88 sec (1.00x) + Maruku (to_html): parsing 0.66 sec + rendering 0.43 sec = 1.09 sec (1.73x) + Maruku (to_latex): parsing 0.67 sec + rendering 0.23 sec = 0.90 sec (2.10x) +</code></pre> +<p>Please note that Maruku has a lot more features and therefore is looking for much more patterns in the file.</p> -<li> -<p>External packages are <code>require</code>d only if needed.</p> -</li> +<h2 id='maruku_summary_of_features'><span class='maruku_section_number'>5. </span>Maruku summary of features</h2> +<ul> <li> -<p>More symbols supported. See the symbol list <a href='http://maruku.rubyforge.org/entity_test.html'>in HTML</a> and <a href='http://maruku.rubyforge.org/entity_test.pdf'>in PDF</a>.</p> -</li> -</ul> -</li> -</ul> +<p>Supported syntax</p> -<h4 id='changes_in_04'>Changes in 0.4</h4> - <ul> -<li>First implementation of <a href='http://maruku.rubyforge.org/proposal.html'>the new meta-data syntax</a>.</li> +<li><a href='http://daringfireball.net/projects/markdown/syntax'>Basic Markdown</a></li> -<li>General refactorization of the code and much cleaner error reporting.</li> +<li><a href='#extra'>Markdown Extra</a></li> -<li>Created <a href='http://maruku.rubyforge.org/rdoc/'>the RDOC documentation</a>.</li> - -<li>The <code>add_whitespace</code> method took too much time &ndash; it was O(n^2).</li> - -<li>Added unit-tests for block-level elements.</li> +<li><a href='#meta'>Meta-data syntax</a></li> </ul> +</li> -<h4 id='changes_in_03'>Changes in 0.3</h4> +<li> +<p>Output</p> <ul> <li> -<p>A real parser is used instead of a regexp-based system, also for span-level elements.</p> +<p>XHTML</p> -<p>Now Maruku is almost 2x faster than Bluecloth, while having more features.</p> - -<p>Here are some benchmarks:</p> -<pre><code>BlueCloth (to_html): parsing 0.00 sec + rendering 1.54 sec = 1.55 sec -Maruku (to_html): parsing 0.47 sec + rendering 0.38 sec = 0.85 sec -Maruku (to_latex): parsing 0.49 sec + rendering 0.25 sec = 0.73 sec</code></pre> -<p>This is the result of running <code>lib/maruku/tests/benchmark.rb</code> on the Markdown specification.</p> +<ul> +<li>Syntax highlighting via the <a href='http://syntax.rubyforge.org/'><code>syntax</code></a> library.</li> +</ul> </li> <li> -<p>Prettier HTML output by adding whitespace.</p> -</li> +<p>LaTeX</p> -<li> -<p>Added a full suite of unit-tests for the span-level parser.</p> +<ul> +<li><a href='#entities'>Translation of HTML entities to LaTeX</a></li> + +<li>Syntax highlighting via the <a href='http://www.ctan.org/tex-archive/macros/latex/contrib/listings/'><code>listings</code></a> package.</li> +</ul> </li> +</ul> +</li> <li> -<p>Error management: Having a real parser, Maruku warns you about syntax issues.</p> +<p>Misc</p> -<p>The default action is to warn and try to continue. If you do this:</p> -<pre><code>Maruku.new(string, {:on_error =&gt; :raise}) -</code></pre> -<p>then syntax errors will cause an exception to be raised (you can catch this and retry).</p> +<ul> +<li> +<p><a href='exd.html'>Documentation for supported attributes</a></p> </li> <li> -<p>Fixed a series of bugs in handling inline HTML code.</p> +<p><a href='#toc-generation'>Automatic generation of the TOC</a></p> </li> </ul> +</li> +</ul> -<p>Immediate TODO-list:</p> +<p><strong>Experimental features (not released yet)</strong></p> <ul> -<li> -<p>UTF-8 input/output works OK for HTML, however I am having pain trying to export to LaTeX. I want at least Japanese characters support, so if you know how to do this you are very welcome to give me an hand.</p> +<li><a href='http://maruku.rubyforge.org/math.xhtml'>LaTeX Math syntax</a> (not enabled by default)</li> -<p>For example: in the HTML version, you should see accented characters in this parenthesis:</p> +<li>An extension system for adding new syntax is available, but the API is bound to change in the future, so please don&#8217;t use it.</li> -<blockquote> -<p>(àèìòù)</p> -</blockquote> +<li>LaTeX to MathML using either one of <a href='http://ritex.rubyforge.org'><code>ritex</code></a>, <a href='http://golem.ph.utexas.edu/~distler/code/itexToMML/'><code>itex2mml</code></a>, <a href='http://www.blahtex.org'><code>blahtex</code></a>.</li> -<p>and Japanese text in these other parentheses:</p> +<li>LaTeX to PNG using <a href='http://www.blahtex.org'><code>blahtex</code></a>.</li> +</ul> -<blockquote> -<p>(カタカナで 私の 名前は アンドレア チェンシ です).</p> +<h3 id='meta'><span class='maruku_section_number'>5.1. </span>New meta-data syntax</h3> -<p>(日本のガルは 大好き、でも、日本語は難しですから、そうぞ 英語話すガルを おしえてください).</p> -</blockquote> +<p>Maruku implements a syntax that allows to attach &#8220;meta&#8221; information to objects.</p> -<p>In the LaTeX version, these do not appear. I know how to do LaTeX with ISO-8859-1 encoding (European characters), but I&rsquo;m struggling with half-baked solutions for UTF-8 encoded documents.</p> -</li> +<p>See <a href='http://maruku.rubyforge.org/proposal.html'>this proposal</a> for how to attach metadata to the elements.</p> -<li> -<p>Implement the <a href='http://maruku.rubyforge.org/proposal.html'>new meta-data proposal</a>.</p> -</li> +<p>See the <a href='exd.html'>documentation for supported attributes</a>.</p> -<li> -<p>Exporting to Markdown (pretty printing).</p> -</li> +<p>Meta-data for the document itself is specified through the use of email headers:</p> +<pre><code>Title: A simple document containing meta-headers +CSS: style.css -<li> -<p>Exporting to HTML splitting in multiple files.</p> -</li> - -<li> -<p>RubyPants.</p> -</li> - -<li> -<p>Support for images in PDF.</p> -</li> -</ul> - -<h2 id='download'><span class='maruku_section_number'>2. </span>Download</h2> - -<p>The development site is <a href='http://rubyforge.org/projects/maruku/'>http://rubyforge.org/projects/maruku/</a>.</p> - -<p>Install with:</p> -<pre><code>$ gem install maruku +Content of the document </code></pre> -<p>Released files can also be seen at <a href='http://rubyforge.org/frs/?group_id=2795'>http://rubyforge.org/frs/?group_id=2795</a>.</p> - -<p>Anonymous access to the repository is possible with:</p> -<pre><code>$ svn checkout svn://rubyforge.org/var/svn/maruku +<p>When creating the document through</p> +<pre><code>Maruku.new(s).to_html_document </code></pre> -<p>If you want commit access to the repository, just create an account on Rubyforge and <a href='http://www.dis.uniroma1.it/~acensi/contact.html'>drop me a mail</a>.</p> +<p>the title and stylesheet are added as expected.</p> -<h3 id='bugs_report'><span class='maruku_section_number'>2.1. </span>Bugs report</h3> +<p>Meta-data keys are assumed to be case-insensitive.</p> -<p>Use the <a href='http://rubyforge.org/tracker/?group_id=2795'>tracker</a> or <a href='http://www.dis.uniroma1.it/~acensi/contact.html'>drop me an email</a>.</p> +<h3 id='toc-generation'><span class='maruku_section_number'>5.2. </span>Automatic generation of the table of contents</h3> -<h2 id='usage'><span class='maruku_section_number'>3. </span>Usage</h2> +<p>If you create a list, and then set the <code>toc</code> attribute, when rendering Maruku will create an auto-generated table of contents.</p> +<pre><code>* This will become a table of contents (this text will be scraped). +{:toc} +</code></pre> +<p>You can see an example of this at the beginning of this document.</p> -<p>This is the basic usage:</p> -<pre><code>require &#39;rubygems&#39; -require &#39;maruku&#39; +<h3 id='entities'><span class='maruku_section_number'>5.3. </span>Use HTML entities</h3> -doc = Maruku.new(markdown_string) -puts doc.to_html -</code></pre> -<p>The method <code>to_html</code> outputs only an HTML fragment, while the method <code>to_html_document</code> outputs a complete XHTML 1.0 document:</p> -<pre><code>puts doc.to_html_document -</code></pre> -<p>You can have the REXML document tree with:</p> -<pre><code>tree = doc.to_html_document_tree -</code></pre> -<h3 id='from_the_command_line'><span class='maruku_section_number'>3.1. </span>From the command line</h3> +<p>If you want to use HTML entities, go on! We will take care of the translation to LaTeX:</p> +<table><thead><tr><th>Entity</th><th>Result</th></tr></thead><tbody><tr><td style='text-align: left;'><code>&amp;copy;</code></td><td style='text-align: left;'>&#169;</td> +</tr><tr><td style='text-align: left;'><code>&amp;pound;</code></td><td style='text-align: left;'>&#163;</td> +</tr><tr><td style='text-align: left;'><code>&amp;lambda;</code></td><td style='text-align: left;'>&#955;</td> +</tr><tr><td style='text-align: left;'><code>&amp;mdash;</code></td><td style='text-align: left;'>&#8212;</td> +</tr></tbody></table> +<p>See the <a href='http://maruku.rubyforge.org/entity_test.html'>list of supported entities</a> (<a href='http://maruku.rubyforge.org/entity_test.pdf'>pdf</a>).</p> -<p>There are two command-line programs installed: <code>maruku</code> and <code>marutex</code>.</p> +<h3 id='this_header_contains_emphasis_strong_text_and_'><span class='maruku_section_number'>5.4. </span>This header contains <em>emphasis</em> <strong>strong text</strong> and <code>code</code></h3> -<ul> -<li> -<p><code>maruku</code> converts Markdown to HTML:</p> -<pre><code>$ maruku file.md # creates file.html</code></pre></li> +<p>Note that this header contains formatting and it still works, also in the table of contents.</p> -<li> -<p><code>marutex</code> converts Markdown to LaTeX, then calls <code>pdflatex</code> to transform to PDF:</p> -<pre><code>$ marutex file.md # creates file.tex and file.pdf</code></pre></li> -</ul> +<p>And <a href='#features'>This is a <em>link</em> with <strong>all</strong> <strong><em>sort</em></strong> of <code>weird stuff</code></a> in the text.</p> -<h2 id='extra'><span class='maruku_section_number'>4. </span>Examples of PHP Markdown Extra syntax</h2> +<h2 id='extra'><span class='maruku_section_number'>6. </span>Examples of PHP Markdown Extra syntax</h2> <ul> <li> <p>tables</p> <pre><code>Col1 | Very very long head | Very very long head| -----|:-------------------:|-------------------:| -cell | center-align | right-align |</code></pre><table><thead><tr><th>Col1</th><th>Very very long head</th><th>Very very long head</th></tr></thead><tbody><tr><td style='text-align: left;'>cell</td><td style='text-align: center;'>center-align</td><td style='text-align: right;'>right-align</td></tr></tbody></table></li> +cell | center-align | right-align |</code></pre><table><thead><tr><th>Col1</th><th>Very very long head</th><th>Very very long head</th></tr></thead><tbody><tr><td style='text-align: left;'>cell</td><td style='text-align: center;'>center-align</td><td style='text-align: right;'>right-align</td> +</tr></tbody></table></li> <li> <p>footnotes <sup id='fnref:1'><a href='#fn:1' rel='footnote'>1</a></sup></p> <pre><code>* footnotes [^foot] @@ -336,183 +282,18 @@ <li> <p>abbreviations or <abbr title='Simply an abbreviation'>ABB</abbr> for short.</p> </li> </ul> +<!-- +Future developments {#future} -<h2 id='maruku-and-bluecloth'><span class='maruku_section_number'>5. </span>Maruku and Bluecloth</h2> +I think that [Pandoc] and [MultiMarkdown] are very cool projects. +However, they are written in Haskell and Perl, respectively. +I would love to have an equivalent in Ruby. -<p>The other Ruby implementation of Markdown is <a href='http://www.deveiate.org/projects/BlueCloth'>Bluecloth</a>.</p> +[Pandoc]: http://sophos.berkeley.edu/macfarlane/pandoc/ +[MultiMarkdown]: http://fletcher.freeshell.org/wiki/MultiMarkdown -<p>Maruku is much different in philosophy from Bluecloth: the biggest difference is that <em>parsing</em> is separated from <em>rendering</em>. In Maruku, an in-memory representation of the Markdown document is created. Instead, Bluecloth mantains the document in memory as a String at all times, and does a series of <code>gsub</code> to transform to HTML.</p> - -<p>The in-memory representation makes it very easy to export to various formats (at the moment HTML and LaTeX/PDF; the next is pretty-printed Markdown).</p> - -<p>Other improvements over Bluecloth:</p> - -<ul> -<li> -<p>the HTML output is provided also as a <code>REXML</code> document tree.</p> -</li> - -<li> -<p>PHP Markdown Syntax support.</p> -</li> -</ul> - -<h2 id='meta'><span class='maruku_section_number'>6. </span>New meta-data syntax</h2> - -<p>Maruku implements a syntax that allows to attach &ldquo;meta&rdquo; information to objects.</p> - -<h3 id='metadata_for_blocklevel_and_spanlevel_elements'><span class='maruku_section_number'>6.1. </span>Meta-data for block-level and span-level elements</h3> - -<p>See <a href='http://maruku.rubyforge.org/proposal.html'>this proposal</a>.</p> - -<h3 id='metadata_for_the_document'><span class='maruku_section_number'>6.2. </span>Meta-data for the document</h3> - -<p>Meta-data for the document itself is specified through the use of email headers:</p> -<pre><code>Title: A simple document containing meta-headers -CSS: style.css - -Content of the document -</code></pre> -<p>When creating the document through</p> -<pre><code>Maruku.new(s).to_html_document -</code></pre> -<p>the title and stylesheet are added as expected.</p> - -<p>Meta-data keys are assumed to be case-insensitive.</p> -<hr /> -<h3 id='metalist'><span class='maruku_section_number'>6.3. </span>List of meta-data</h3> - -<dl> -<dt><strong><code>title</code>, <code>subject</code></strong></dt> - -<dd> -<p>(document) Sets the title of the document (HTML: used in the <code>TITLE</code> element).</p> -</dd> - -<dt><strong><code>use_numbered_headers</code></strong></dt> - -<dd> -<p>(document) If <code>true</code>, headers are numbered (just like this document). Default is <code>false</code>.</p> -</dd> - -<dt><strong><code>css</code></strong></dt> - -<dd> -<p>(document, HTML) Url of stylesheet.</p> -</dd> - -<dt><strong><code>html_use_syntax</code></strong></dt> - -<dd> -<p>(document, HTML) If set, use the <a href='http://syntax.rubyforge.org/'>Ruby <code>syntax</code> library</a> to add source highlighting.</p> -</dd> - -<dt><strong><code>latex_use_listings</code></strong></dt> - -<dd> -<p>(document, LaTeX) If set, use the fancy <a href='http://www.ctan.org/tex-archive/macros/latex/contrib/listings/'><code>listings</code> package</a> for better displaying code blocks.</p> - -<p>If not set, use standard <code>verbatim</code> environment.</p> -</dd> - -<dt><strong><code>style</code>, <code>id</code>, <code>class</code></strong></dt> - -<dd> -<p>(any block object, HTML) Standard CSS attributes are copied.</p> -</dd> - -<dt><strong><code>lang</code></strong></dt> - -<dd> -<p>(code blocks) Name of programming language (<code>ruby</code>) for syntax highlighting.</p> - -<p>Default for this is <code>code_lang</code> in document.</p> - -<p>Syntax highlighting is delegated to the <a href='http://syntax.rubyforge.org/'><code>syntax</code> library</a> for HTML output and to the <a href='http://www.ctan.org/tex-archive/macros/latex/contrib/listings/'><code>listings</code> package</a> for LaTeX output.</p> -</dd> - -<dt><strong><code>code_show_spaces</code></strong></dt> - -<dd> -<p>Shows tabs and newlines (default is read in the document object).</p> -</dd> - -<dt><strong><code>code_background_color</code></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 (<code>green</code>, <code>red</code>) or a CSS color of the form <code>#ff00ff</code>.</p> - -<ul> -<li> -<p>for <strong>HTML output</strong>, the value is put straight in the <code>background-color</code> 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 <code>color</code> packages. If it is of the form <code>#ff00ff</code>, Maruku defines a color using the <code>\color[rgb]{r,g,b}</code> macro.</p> - -<p>For example, for <code>#0000ff</code>, the macro is called as: <code>\color[rgb]{0,0,1}</code>.</p> -</li> -</ul> -</dd> -</dl> - -<h3 id='examples'><span class='maruku_section_number'>6.4. </span>Examples</h3> - -<p>An example of this is the following:</p> -<pre><code> One space - Two spaces - Tab, space, tab - Tab, tab, tab and all is green! -{:code_show_spaces code_background_color=#ffeedd}</code></pre> -<p>That will produce:</p> -<pre style='background-color: #ffeedd;'><code>&not;One&not;space -&not;&not;Two&not;spaces -&raquo;&nbsp;&nbsp;&nbsp;&not;&raquo;&nbsp;&nbsp;&nbsp;Tab,&not;space,&not;tab -&raquo;&nbsp;&nbsp;&nbsp;&raquo;&nbsp;&nbsp;&nbsp;&raquo;&nbsp;&nbsp;&nbsp;Tab,&not;tab,&not;tab&not;and&not;all&not;is&not;green!</code></pre> -<p>Or highlighting (support depends on languages):</p> -<pre><code> &lt;div style=&quot;text-align:center&quot;&gt;Div&lt;/div&gt; -{:lang=html} -</code></pre> -<p>produces:</p> -<pre class='xml'><span class='punct'>&lt;</span><span class='tag'>div</span> <span class='attribute'>style</span><span class='punct'>=&quot;</span><span class='string'>text-align:center</span><span class='punct'>&quot;&gt;</span>Div<span class='punct'>&lt;/</span><span class='tag'>div</span><span class='punct'>&gt;</span></pre><hr /> -<h2 id='features'><span class='maruku_section_number'>7. </span>Other Features</h2> - -<h3 id='automatic_generation_of_the_table_of_contents'><span class='maruku_section_number'>7.1. </span>Automatic generation of the table of contents</h3> - -<p>If you create a list, and then set the <code>toc</code> attribute, when rendering Maruku will create an auto-generated table of contents.</p> -<pre><code>* This will become a table of contents (this text will be scraped). -{:toc} -</code></pre> -<p>You can see an example of this at the beginning of this document.</p> - -<h3 id='this_header_contains_emphasis_strong_text_and_'><span class='maruku_section_number'>7.2. </span>This header contains <em>emphasis</em> <strong>strong text</strong> and <code>code</code></h3> - -<p>Note that this header contains formatting and it still works, also in the table of contents.</p> - -<p>And <a href='#features'>This is a <em>link</em> with <strong>all</strong> <strong><em>sort</em></strong> of <code>weird stuff</code></a> in the text.</p> - -<h3 id='use_html_entities'><span class='maruku_section_number'>7.3. </span>Use HTML entities</h3> - -<p>If you want to use HTML entities, go on! We will take care of the translation to LaTeX:</p> -<table><thead><tr><th>Entity</th><th>Result</th></tr></thead><tbody><tr><td style='text-align: left;'><code>&amp;copy;</code></td><td style='text-align: left;'>&copy;</td></tr><tr><td style='text-align: left;'><code>&amp;pound;</code></td><td style='text-align: left;'>&pound;</td></tr><tr><td style='text-align: left;'><code>a&amp;nbsp;b</code></td><td style='text-align: left;'>a&nbsp;b</td></tr><tr><td style='text-align: left;'><code>&amp;lambda;</code></td><td style='text-align: left;'>&lambda;</td></tr><tr><td style='text-align: left;'><code>&amp;mdash;</code></td><td style='text-align: left;'>&mdash;</td></tr></tbody></table> -<h2 id='future'><span class='maruku_section_number'>8. </span>Future developments</h2> - -<p>I think that <a href='http://sophos.berkeley.edu/macfarlane/pandoc/'>Pandoc</a> and <a href='http://fletcher.freeshell.org/wiki/MultiMarkdown'>MultiMarkdown</a> are very cool projects. However, they are written in Haskell and Perl, respectively. I would love to have an equivalent in Ruby.</p> - -<h3 id='a_syntax_for_adding_math'><span class='maruku_section_number'>8.1. </span>A syntax for adding math</h3> - -<p>Something inspired from LaTeX should be familiar to all:</p> -<pre><code>This is inline math: $\alpha$ - - -This is an equation with label: - -$ \alpha = \beta + \gamma $ (eq:1) - -This is a reference to equation: please see (eq:1)</code></pre><div class='footnotes'><hr /><ol><li id='fn:1'> +--><div class='footnotes'><hr /><ol><li id='fn:1'> <p>I really was missing those.</p> -<a href='#fnref:1' rev='footnote'>&#8617;</a></li></ol></div></body></html> +<a href='#fnref:1' rev='footnote'>&#8617;</a></li></ol></div><div class='maruku_signature'><hr /><span style='font-size: small; font-style: italic'>Created by <a href='http://maruku.rubyforge.org' title='Maruku: a Markdown-superset interpreter for Ruby'>Maruku</a> at 14:11 on Tuesday, January 23rd, 2007.</span></div></body></html>