All Projects → textile → Php Textile

textile / Php Textile

Licence: other
Textile markup language parser for PHP

Projects that are alternatives of or similar to Php Textile

Sh
A shell parser, formatter, and interpreter with bash support; includes shfmt
Stars: ✭ 4,343 (+2071.5%)
Mutual labels:  parser, formatter
Proto
parser for Google ProtocolBuffers definition
Stars: ✭ 359 (+79.5%)
Mutual labels:  parser, formatter
Graphql Parser
A graphql query language and schema definition language parser and formatter for rust
Stars: ✭ 203 (+1.5%)
Mutual labels:  parser, formatter
Sqlformat
.NET SQL Parser and Formatter Tool and SSMS Plugin
Stars: ✭ 49 (-75.5%)
Mutual labels:  parser, formatter
Globalize
A JavaScript library for internationalization and localization that leverages the official Unicode CLDR JSON data
Stars: ✭ 4,612 (+2206%)
Mutual labels:  parser, formatter
Swaggen
OpenAPI/Swagger 3.0 Parser and Swift code generator
Stars: ✭ 385 (+92.5%)
Mutual labels:  parser, formatter
Godot Gdscript Toolkit
Independent set of GDScript tools - parser, linter and formatter
Stars: ✭ 214 (+7%)
Mutual labels:  parser, formatter
Verible
Verible is a suite of SystemVerilog developer tools, including a parser, style-linter, and formatter.
Stars: ✭ 384 (+92%)
Mutual labels:  parser, formatter
Google Libphonenumber
The up-to-date and reliable Google's libphonenumber package for node.js.
Stars: ✭ 984 (+392%)
Mutual labels:  parser, formatter
Laravel Oh Generators
This package extends the core file generators that are included with Laravel 5 or later.
Stars: ✭ 96 (-52%)
Mutual labels:  parser, formatter
M3u8parser
A light weight M3U8 parser. Support X-Key & X-Session-Key.
Stars: ✭ 187 (-6.5%)
Mutual labels:  parser
Readability
Readability is Elixir library for extracting and curating articles.
Stars: ✭ 188 (-6%)
Mutual labels:  parser
Pytimeparse
A small Python module to parse various kinds of time expressions.
Stars: ✭ 195 (-2.5%)
Mutual labels:  parser
Tatsu
竜 TatSu generates Python parsers from grammars in a variation of EBNF
Stars: ✭ 198 (-1%)
Mutual labels:  parser
Jstoolnpp
A JavaScript (JSON) tool for Notepad++ (formerly JSMinNpp) and Visual Studio Code.
Stars: ✭ 186 (-7%)
Mutual labels:  formatter
Diagon
Interactive ASCII art diagram generators. 🌟
Stars: ✭ 189 (-5.5%)
Mutual labels:  parser
Flora Sql Parser
Parse SQL (select) statements into abstract syntax tree (AST) and convert ASTs back to SQL.
Stars: ✭ 186 (-7%)
Mutual labels:  parser
Parse Xml
A fast, safe, compliant XML parser for Node.js and browsers.
Stars: ✭ 184 (-8%)
Mutual labels:  parser
Curl Trace Parser
Parser for output from Curl --trace option
Stars: ✭ 183 (-8.5%)
Mutual labels:  parser
Goparsec
Parser combinator in Go. If there are any cross platform issues or backward compatibility issues, please reach out.
Stars: ✭ 198 (-1%)
Mutual labels:  parser

h1. PHP-Textile

"Downloads":https://github.com/textile/php-textile/releases | "Textile reference":https://textile-lang.com/ | "Live editor":https://textile-lang.com/doc

!https://img.shields.io/travis/textile/php-textile/master.svg!:https://travis-ci.org/textile/php-textile !https://img.shields.io/coveralls/github/textile/php-textile/master.svg!:https://coveralls.io/r/textile/php-textile?branch=master !https://img.shields.io/packagist/v/netcarver/textile.svg!:https://packagist.org/packages/netcarver/textile !https://img.shields.io/packagist/dt/netcarver/textile.svg!:https://packagist.org/packages/netcarver/textile

PHP-Textile is a modern Textile markup language parser for PHP. Textile is a humane web text generator that takes lightweight, readable, plaintext-like markup language and converts it into well formed HTML.

h2. Install

Using "Composer":https://getcomposer.org/:

bc. $ composer require netcarver/textile

h2. Usage

The Textile parser can be accessed through the @Netcarver\Textile\[email protected] class. The class is highly configurable, and actual parsing happens with the @parse@ method:

bc. require './vendor/autoload.php'; $parser = new \Netcarver\Textile\Parser(); echo $parser->parse('h1. Hello World!');

h3. Parsing untrusted input

If you are using PHP-Textile to format user-supplied input, blog comments for instance, remember to enable restricted parser mode:

bc. $parser = new \Netcarver\Textile\Parser(); echo $parser ->setRestricted(true) ->parse('!bad/image/not/allowed.svg!');

In restricted mode PHP-Textile doesn't allow more powerful formatting options such as inline styles, and removes any raw HTML.

h3. Parsing single-line fields

If you are using PHP-Textile as a field-level formatter to parse just inline spans and glyphs, use the @[email protected] method to disable block tags:

bc. $parser = new \Netcarver\Textile\Parser(); echo $parser ->setBlockTags(false) ->parse('Hello strong world!');

The above outputs:

bc. Hello strong world!

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 via the @[email protected] method:

bc. $parser = new \Netcarver\Textile\Parser(); echo $parser ->setDocumentType('html5') ->parse('HTML(HyperText Markup Language)');

h3. Setting alternate glyphs

Textile's typographic substitutions can be overridden with the @[email protected] method. If you need to setup Textile to do non-standard substitutions, call @[email protected] before you parse the input with @parse@.

bc. $parser = new \Netcarver\Textile\Parser(); $parser ->setSymbol('half', '1⁄2') ->parse('Hello [1/2] World!');

The symbol names you can pass to @https://github.com/textile/php-textile/blob/v3.6.1/src/Netcarver/Textile/Parser.php#L710.

h3. Prefixing relative image and link paths

Setting prefix might be useful if you want to point relative paths to certain consistent location:

bc. $parser = new \Netcarver\Textile\Parser(); $parser ->setImagePrefix('/user/uploads') ->setLinkPrefix('/') ->parse('!image.jpg! "link":page');

h2. Getting in contact

The PHP-Textile project welcomes constructive input and bug reports from users. Please "open an issue":https://github.com/textile/php-textile/issues on the repository for a comment, feature request or bug.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].