retro spiller

technokracy

CakePHP Markdown Helper Plugin

The plugin is available at Github as CakePHP-Markdown-Plugin.

A PHP Markdown helper packaged as a plugin, includes php-markdown.php.

Installation:

Using Composer/Packagist:

If you are using composer, require chronon/markdown:

1
2
3
4
5
6
7
8
{
    "require": {
        "chronon/markdown": "*"
    },
  "config": {
        "vendor-dir": "Vendor"
    }
}

This will install the plugin into Plugin/Markdown, and install Markdown lib (from Packagist) into your Vendor directory.

In Config/bootstrap.php, import composer’s autoload file:

1
2
<?php
App::import('Vendor', array('file' => 'autoload'));

Using git:

If you are not using composer, clone the repository:

1
git clone git@github.com:chronon/CakePHP-Markdown-Plugin.git APP/Plugin/Markdown

Usage:

In your controller:

1
2
<?php
public $helpers = array('Markdown.Markdown');

In your view:

1
2
<?php
echo $this->Markdown->md(markdown_to_be_converted_to_html);