I have created another plugin for the MarkItUp widget. I know that 
plugin_wiki has this currently, but I wanted a dedicated plugin for this 
for an upcoming project I'm working on.

You can get the plugin from 
Bitbucket: https://bitbucket.org/PhreeStyle/web2py_markitup

There is no documentation yet, as I just pushed the code. But I wanted to 
announce in case anyone wants to play with this. It has not been thoroughly 
tested and is only an alpha at this point. It can be used with several 
different markup languages:

   - BBCode
   - HTML
   - Markdown
   - Markmin
   - reStructuredText
   - Textile
   - Wiki

The plugin can be used standalone, or as a form field widget. It currently 
supports live previews for 4 markup languages: html, markmin, markdown, 
textile, and bbcode. Code blocks for markmin and markdown markup are 
highlighted by pygments, which is included as part of the plugin. No 
external dependencies. Using pygments for code highlighting allows over 100 
languages to be highlighted.

Code highlighting in markmin:

``
def testing():
    print 'Testing'
``:python

Code highlighting in markdown:

    :::python
    def testing():
        print 'Testing'

Markdown requires four spaces at the beginning of each line for code blocks.

Example for basic usage:

from plugin_markitup.markitup import MarkItUp

def test():
    widget = MarkItUp(set_name='markmin').markitup()
    return dict(widget=widget)


Example model for form fields:

from plugin_markitup.markitup import MarkItUp

db.define_table('content',
    Field('name', length=20),
    Field('description', 'text')
)
db.content.description.widget = MarkItUp().widget


Example controller:
def test():
    form = SQLFORM(db.content)
    if form.accepts(request, session):
        redirect(URL())

    return dict(form=form)


This plugin is more of an alpha preview, so I expect there to be problems 
and inconsistencies. Please try it out and let me know if you have any 
questions, comments, or problems!

Reply via email to