h1. Textile for PHP "Downloads":https://github.com/textile/php-textile/releases | "Textile reference":http://txstyle.org/article/43/a-short-introduction | "Live editor":http://txstyle.org/ | "Packagist":https://packagist.org/packages/netcarver/textile *Textile is a humane web text generator*. It takes lightweight, readable, plaintext-like markup language and converts it into well formed HTML. This repository contains a Textile parser for PHP. The 2.4 branch contains PHP 4 compatible legacy version of PHP-Textile. This branch is feature frozen as of 2012-08-23 and should be considered dropped. Do not use this for new installations, instead see v3.5.x and newer. !https://travis-ci.org/textile/php-textile.png?branch=2.4!:https://travis-ci.org/textile/php-textile h2. Installation The only file that is necessary for the correct operation of Textile 2.* is @classTextile.php@ from the root directory. "Grab a copy of the latest Textile v2.4.x release":https://github.com/textile/php-textile/releases, extract the archive and include the @classTextile.php@ file in your application: bc. include "classTextile.php"; h2. Usage Textile parser can be accessed through the @Textile@ class. The class is highly configurable, and actual parsing happens with the @textileThis@ and @textileRestricted@ methods: bc. $parser = new Textile(); echo $parser->textileThis('h1. Hello World!'); h3. Parsing untrusted input If you are using Textile to format user-supplied input, blog comments for instance, use the @textileRestricted()@ method: bc. $parser = new Textile(); echo $parser->textileRestricted('!bad/image/not/allowed.svg!'); This method doesn't allow the more powerful formatting options such as inline style, and removes any raw HTML. h3. Doctypes Currently, PHP Textile can target either XHTML or HTML5 output with XHTML being the default for backward compatibility. The targeted doctype can be changed through the constructor: bc. $parser = new Textile('html5'); echo $parser->textileThis('HTML(HyperText Markup Language)"); In HTML5 mode, you'll get @abbr@ instead of @acronym@ and if you use alignment markers on your images you'll have extra classes placed on them instead of XHTML's @align@ attribute. h2. Running tests Included unit tests can be run with PHPunit: bc. $ composer install --dev $ ./vendor/bin/phpunit Running tests requires PHP 5.3.3 and PCRE with PCRE_UTF8. h2. Getting In Contact The textile project welcomes constructive input and bug reports from users. You can contact us in several ways. * "Open an issue":https://github.com/textile/php-textile/issues on the repository for a feature request or bug. * If you are on IRC, feel free to drop into *#textile* on *freenode.net* ("webchat":http://webchat.freenode.net/?channels=#textile.) * Use the generic "contact form":http://sitemonks.com/.