PHPackages                             softark/creole - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. softark/creole

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

softark/creole
==============

Creole Wiki parser for PHP extended from cebe/markdown

1.3.0.2(2y ago)1444.5k↓26.1%52MITPHPPHP &gt;=5.4.0CI failing

Since Apr 5Pushed 2y ago1 watchersCompare

[ Source](https://github.com/softark/creole)[ Packagist](https://packagist.org/packages/softark/creole)[ Docs](https://github.com/softark/creole#readme)[ RSS](/packages/softark-creole/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (9)Used By (2)

creole parser extended from cebe/markdown
=========================================

[](#creole-parser-extended-from-cebemarkdown)

[![Build Status](https://camo.githubusercontent.com/387fd8fb9a1c26448e50f04b72b4ad39c575ea3a58b7387704d886557161d5bf/68747470733a2f2f7472617669732d63692e6f72672f736f667461726b2f6372656f6c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/softark/creole)[![Code Coverage](https://camo.githubusercontent.com/81050215559c95552b10f858cda5ea7ddbe38339dc5181131e6d545529cc1707/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f736f667461726b2f6372656f6c652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/softark/creole/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/0af454686c687de5d1f0102681c3f19abd219864bce59e0f9770e7f9500e799c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f736f667461726b2f6372656f6c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/softark/creole/?branch=master)

What is this?
----------------------------------------------

[](#what-is-this-)

This is a [Creole Wiki](http://www.wikicreole.org/wiki/Creole1.0) parser for PHP built upon [cebe/markdown parser for PHP](https://github.com/cebe/markdown).

Installation
-----------------------------------------------------

[](#installation-)

[PHP 5.4 or higher](http://www.php.net/downloads.php) is required to use it. It will also run on facebook's [hhvm](http://hhvm.com/).

Installation is recommended to be done via [composer](https://getcomposer.org/ "The PHP package manager") by running:

```
composer require softark/creole "~1.2"

```

Alternatively you can add the following to the `require` section in your `composer.json` manually:

```
"softark/creole": "~1.2"
```

Run `composer update` afterwards.

Note that the installation automatically includes the dependent packages, especially "cebe/markdown", to make the creole parser functional.

Usage
---------------------------------------

[](#usage-)

The usage of the creole parser is similar to that of cebe/markdown parser.

### In your PHP project

[](#in-your-php-project)

To parse your wiki text you need only two lines of code. The first one is to create the creole parser instance:

```
$parser = new \softark\creole\Creole();

```

The next step is to call the `parse()`-method for parsing the text using the full wiki language or calling the `parseParagraph()`-method to parse only inline elements:

```
$parser = new \softark\creole\Creole();
$outputHtml = $parser->parse($wikiText);

// parse only inline elements (useful for one-line descriptions)
$parser = new \softark\creole\Creole();
$outputHtml = $parser->parseParagraph($wikiText);
```

You may optionally set the following option on the parser object:

- `$parser->html5 = false` to enable HTML4 output instead of HTML5.

And you should set the following properties when you are using the wiki style links, i.e. \[\[link\]\] for an internal link and \[\[WikiName:link\]\] for an external link:

- `$parser->wikiUrl = 'http://www.example.com/wiki/'` for the url of the current wiki.
- `$parser->externalWikis = ['Wiki-A' => 'http://www.wiki-a.com/', 'Wiki-B' => 'http://www.wiki-b.net/']`for the external wikis. It should be an array in which the keys are the name of the wiki and the value the urls of them.

It is recommended to use UTF-8 encoding for the input strings. Other encodings are currently not tested.

### Using markdown-like cell text aligning

[](#using-markdown-like-cell-text-aligning)

In the version 1.3.0 and later, you may optionally use the cell text aligning syntax which is used in markdown. If you write the 2nd line of the table source text using the markdown table syntax, the cell text aligning will be rendered. If the 2nd line is not markdown compliant, nothing will happen.

Note that this function only adds some classes to **td** tags like the following:

```

1st col
2nd col
3rd col
4th col

```

In the above, the text in the 2nd col **should** be left-aligned, the 3rd right-aligned, and the 4th center-aligned. Wwhen you fail to supply proper styles for those classes, then nothing will happen.

So remember to supply a proper style sheet like the following:

```
td.left { text-align: left }
td.right { text-align: right }
td.center { text-align: center }

```

### Using raw html blocks

[](#using-raw-html-blocks)

In the version 1.2.0 and later, you may optionally include raw html blocks in the source wiki text, although this feature is disabled by default because it's not in the Creole 1.0 specification.

You can enable this feature by specifying the following option:

- `$parser->useRawHtml = true`

A raw html block should start with a line that only contains ``, for example:

```
>

```

Note that the output of the raw html blocks get **CLEANSED** automatically with `$parser->rawHtmlFilter` when it is specified. A recommendation is to use HTML Purifier for the filter. For example:

```
$parser->rawHtmlFilter = function($input) {
    $config = \HTMLPurifier_Config::createDefault();
    $purifier = \HTMLPurifier::getInstance($config);
    return $purifier->purify($input);
};

// Or, if you are using Yii 2
$parser->rawHtmlFilter = function($input) {
    return \yii\helpers\HtmlPurifier::process($input);
};

```

As you see in the example, the `rawHtmlFilter` should be a callable that accepts the possibly unclean html text string and output the sanitized version of it.

### The command line script

[](#the-command-line-script)

You can use it to convert a wiki text to a html file:

```
bin/creole some.txt > some.html

```

Here is the full Help output you will see when running `bin/creole --help`:

```
PHP Creole to HTML converter
----------------------------

by Nobuo Kihara

Usage:
    bin/creole [--full] [file.txt]

    --full    ouput a full HTML page with head and body. If not given, only the parsed markdown will be output.

    --help    shows this usage information.

    If no file is specified input will be read from STDIN.

Examples:

    Render a file with original creole:

        bin/creole README.txt > README.html

Convert the original creole description to html using STDIN:

    curl http://www.wikicreole.org/attach/Creole1.0TestCases/creole1.0test.txt | $cmd > creole.html

```

Acknowledgements
------------------------------------------------

[](#acknowledgements-)

I'd like to thank [@cebe](https://github.com/cebe "Carsten Brandt") for creating [cebe/markdown](https://github.com/cebe/markdown "A super fast, highly extensible markdown parser for PHP") library on which this work depends.

As its name describes, cebe/markdown is a markdown parser, but is also a well designed general purpose markup language parser at the bottom on which you can implement parsers not only for different "flavors" of markdown but also for different markup languages, Creole for instance.

FAQ
-----------------------------------

[](#faq-)

### Where do I report bugs or rendering issues?

[](#where-do-i-report-bugs-or-rendering-issues)

Just [open an issue](https://github.com/softark/creole/issues/new) on github, post your creole code and describe the problem. You may also attach screenshots of the rendered HTML result to describe your problem.

### Am I free to use this?

[](#am-i-free-to-use-this)

This library is open source and licensed under the [MIT License](http://opensource.org/licenses/MIT). This means that you can do whatever you want with it as long as you mention my name and include the [license file](https://github.com/softark/creole/blob/master/LICENSE). Check the [license](https://github.com/softark/creole/blob/master/LICENSE) for details.

Contact
-------

[](#contact)

Feel free to contact me using [email](mailto:softark@gmail.com) or [twitter](https://twitter.com/softark).

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~454 days

Recently: every ~269 days

Total

8

Last Release

879d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/137fd618f00ec6d2ea604559a9c83d3ddecbd12cc8782ad04231b1cfadcacd80?d=identicon)[softark](/maintainers/softark)

---

Top Contributors

[![softark](https://avatars.githubusercontent.com/u/342857?v=4)](https://github.com/softark "softark (32 commits)")

---

Tags

parserwikicreole

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/softark-creole/health.svg)

```
[![Health](https://phpackages.com/badges/softark-creole/health.svg)](https://phpackages.com/packages/softark-creole)
```

###  Alternatives

[nikic/php-parser

A PHP parser written in PHP

17.4k902.6M1.8k](/packages/nikic-php-parser)[doctrine/lexer

PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.

11.2k910.8M118](/packages/doctrine-lexer)[erusev/parsedown

Parser for Markdown.

15.0k151.8M732](/packages/erusev-parsedown)[league/commonmark

Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)

3.0k404.0M702](/packages/league-commonmark)[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M65](/packages/sabberworm-php-css-parser)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
