Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A simple way to add markdown editors to your project
JavaScript PHP
Latest commit 8475a5a @jmather prepped for v1.2.0

Provdes an easy way to add Markdown to your symfony project.

Using the markdown and smartypants libraries from Michel Fortin, and the MarkItUp editor, I have made an easy to use widget and library for using Markdown content in Symfony.

It assumes majaxJqueryPlugin is loaded (or some form of jQuery 1.4.x and jQuery UI 1.8.x)

Basic Setup

Enable the majaxMarkdown module in your application's settings.yml

To use the widget in your Form class:

class ... snip

  public function configure()
    // ... snip ...

    $parameters = array();
    $attributes = array('style' => 'height: 100px;');
    $this->setWidget('content', new majaxWidgetFormMarkdownEditor($parameters, $attributes));

    // ... snip ...

To render the content:

  echo majaxMarkdown::transform($markdown_content);

You can control it with options in your app.yml:

    style: markdown_extra # choose markdown or markdown_extra
    smartypants_enabled: true # true / false
    smartypants_style: smartypants_typographer # choose smartypants or smartypants_typographer
    smartypants_options: 1 # You'll want to check the smartypants docs for more info on this...
    post_render: false
    post_preview: false

Adding Post Renderers

You can post-process both the generated text, and also only the preview text, by supplying what function to run to app_majaxMedia_post_render or app_majaxMedia_post_preview like so:

 sfConfig::set('app_majaxMedia_post_render', array('className', 'static_function'));


sfConfig::set('app_majaxMedia_post_preview', 'some_function_name');
Something went wrong with that request. Please try again.