corneltek/twig-markdown

There is no license information available for the latest version (1.0.0) of this package.

1.0.0 2015-07-13 14:05 UTC

This package is auto-updated.

Last update: 2024-11-29 03:37:34 UTC


README

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してるのでもっとスマートな方法おしえてください