Giter Site home page Giter Site logo

tobiaswooldridge / majaxmarkdownplugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jmather/majaxmarkdownplugin

0.0 2.0 0.0 296 KB

A simple way to add markdown editors to your project

Home Page: http://www.symfony-project.org/plugins/majaxMarkdownPlugin

License: Other

PHP 31.08% JavaScript 68.92%

majaxmarkdownplugin's Introduction

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:

all:
  majaxMarkdown:
    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'));

or

sfConfig::set('app_majaxMedia_post_preview', 'some_function_name');

majaxmarkdownplugin's People

Contributors

jmather avatar

Watchers

Tobias Wooldridge avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.