extend twig with markdown converter (filter/function)
PHP
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib/Twig Fix Markdown extension namespace Jan 23, 2013
README.mkd update readme Jan 27, 2013
composer.json Provide composer.json Jan 23, 2013
package.ini update readme Jan 27, 2013
package.xml update readme Jan 27, 2013

README.mkd

Twig-Markdown

convert markdowned text to html for Twig.

markdown converter is php-markdown-extra.

Install

Install via PEAR

Install via PEAR installer locally:

$ pear install -f package.xml

Install via PEAR installer from Corneltek PEAR channel:

$ pear install -a corneltek/Twig_Extensions_Markdown

Install via composer

Install composer in your project:

curl -s http://getcomposer.org/installer | php

Create a composer.json file in your project root:

{
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "michelf/php-markdown",
                "version": "1.0",
                "dist": {
                    "url": "https://github.com/michelf/php-markdown/zipball/extra",
                    "type": "zip"
                },
                "autoload": {
                    "files": [
                        "markdown.php"
                    ]
                }
            }
        },
        {
            "type": "vcs",
            "url": "http://github.com/geta6/Twig-Markdown"
        }
    ],
    "require": {
        "michelf/php-markdown": "1.*",
        "geta6/twig-markdown": "@dev"
    }
}

Run install command:

php composer.phar install

Usage

{% markdown %}markdownedtext{% endmarkdown %}

or

{{ markdowned|markdown|raw }}

include

# use built-in twig autoloader
require_once 'Twig/Autoloader.php';
Twig_Autoloader::register();

$debug = new \Twig_Extensions_Extension_Debug;
$twig->addExtension( $debug );

$markdown = new \Twig_Extension_Markdown;
$twig->addExtension( $markdown );

Development

To update the package.xml file, you need to install onion:

todo

むりやりincludeしてるのでもっとスマートな方法おしえてください