mò CµMc@sdkZdkZddgZdZdZeidƒZeidƒZeidedeiƒZ eid ƒd feid ƒd feid ƒd feid ƒdfeidei ƒdfeidei ƒdfeidei ƒdfeidei ƒdfeidei ƒdfeidei ƒdfeidei ƒdfeidei ƒdfeidƒd feid!ƒd feid"ƒd#feid$ƒd%fgZ eid&ei eiBƒZ eid'ƒZ eid(ƒZeid)ƒZeid*ƒZeid+ƒZeid,ƒZeid-ƒZeid.ei ƒZhhd/d0„Zhhd/d1„Zed2jo”dkZdkZeid3d4!d5gjod6eeƒd7GHnNeeiƒd3jo-d6eeeid3d8ƒiƒƒd7GHn eiƒndS(9Ntrendert markmin2htmlsG # Markmin markup language ## About This is a new markup language that we call markmin designed to produce high quality scientific papers and books and also put them online. We provide serializers for html, latex and pdf. It is implemented in the ``markmin2html`` function in the ``markmin2html.py``. Example of usage: `` >>> m = "Hello **world** [[link http://web2py.com]]" >>> from markmin2html import markmin2html >>> print markmin2html(m) >>> from markmin2latex import markmin2latex >>> print markmin2latex(m) >>> from markmin2pdf import markmin2pdf # requires pdflatex >>> print markmin2pdf(m) `` ## Why? We wanted a markup language with the following requirements: - less than 100 lines of functional code - easy to read - secure - support table, ul, ol, code - support html5 video and audio elements (html serialization only) - can align images and resize them - can specify class for tables and code elements - can add anchors - does not use _ for markup (since it creates odd behavior) - automatically links urls - fast - easy to extend - supports latex and pdf including references - allows to describe the markup in the markup (this document is generated from markmin syntax) (results depend on text but in average for text ~100K markmin is 30% faster than markdown, for text ~10K it is 10x faster) The [[web2py book http://www.lulu.com/product/paperback/web2py-%283rd-edition%29/12822827]] published by lulu, for example, was entirely generated with markmin2pdf from the online [[web2py wiki http://www.web2py.com/book]] ## Download - http://web2py.googlecode.com/hg/gluon/contrib/markmin/markmin2html.py - http://web2py.googlecode.com/hg/gluon/contrib/markmin/markmin2latex.py - http://web2py.googlecode.com/hg/gluon/contrib/markmin/markmin2pdf.py markmin2html.py and markmin2latex.py are single files and have no web2py dependence. Their license is BSD. ## Examples ### Bold, italic, code and links -------------------------------------------------- **SOURCE** | **OUTPUT** ``# title`` | **title** ``## section`` | **section** ``### subsection`` | **subsection** ``**bold**`` | **bold** ``''italic''`` | ''italic'' ``!`!`verbatim`!`!`` | ``verbatim`` ``http://google.com`` | http://google.com ``[[click me #myanchor]]`` | [[click me #myanchor]] --------------------------------------------------- ### More on links The format is always ``[[title link]]``. Notice you can nest bold, italic and code inside the link title. ### Anchors [[myanchor]] You can place an anchor anywhere in the text using the syntax ``[[name]]`` where ''name'' is the name of the anchor. You can then link the anchor with [[link #myanchor]], i.e. ``[[link #myanchor]]``. ### Images [[some image http://www.web2py.com/examples/static/web2py_logo.png right 200px]] This paragraph has an image aligned to the right with a width of 200px. Its is placed using the code ``[[some image http://www.web2py.com/examples/static/web2py_logo.png right 200px]]``. ### Unordered Lists `` - Dog - Cat - Mouse `` is rendered as - Dog - Cat - Mouse Two new lines between items break the list in two lists. ### Ordered Lists `` + Dog + Cat + Mouse `` is rendered as + Dog + Cat + Mouse ### Tables Something like this `` --------- **A** | **B** | **C** 0 | 0 | X 0 | X | 0 X | 0 | 0 -----:abc `` is a table and is rendered as --------- **A** | **B** | **C** 0 | 0 | X 0 | X | 0 X | 0 | 0 -----:abc Four or more dashes delimit the table and | separates the columns. The ``:abc`` at the end sets the class for the table and it is optional. ### Blockquote A table with a single cell is rendered as a blockquote: ----- Hello world ----- ### Code, ````, escaping and extra stuff `` def test(): return "this is Python code" ``:python Optionally a ` inside a ``!`!`...`!`!`` block can be inserted escaped with !`!. The ``:python`` after the markup is also optional. If present, by default, it is used to set the class of the block. The behavior can be overridden by passing an argument ``extra`` to the ``render`` function. For example: `` >>> markmin2html("!`!!`!aaa!`!!`!:custom", extra=dict(custom=lambda text: 'x'+text+'x')) ``:python generates ``'xaaax'``:python (the ``!`!`...`!`!:custom`` block is rendered by the ``custom=lambda`` function passed to ``render``). ### Html5 support Markmin also supports the