PHPackages                             kwattro/markdown-bundle - 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. kwattro/markdown-bundle

ActiveSymfony-bundle[Parsing &amp; Serialization](/categories/parsing)

kwattro/markdown-bundle
=======================

A Bundle that integrates the Sundown parser

53.3k41PHP

Since Aug 5Pushed 11y ago1 watchersCompare

[ Source](https://github.com/kwattro/KwattroMarkdownBundle)[ Packagist](https://packagist.org/packages/kwattro/markdown-bundle)[ RSS](/packages/kwattro-markdown-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (1)

KwattroMarkdownBundle
=====================

[](#kwattromarkdownbundle)

This bundle lets you easily make use of the markdown parser inside your Symfony applications.

See it in action: [http://www.frenchycode.com/billets/3/voir/test\_du\_kwattromarkdownbundle](http://www.frenchycode.com/billets/3/voir/test_du_kwattromarkdownbundle)Status
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#see-it-in-action-httpwwwfrenchycodecombillets3voirtest_du_kwattromarkdownbundlestatus)

This bundle is in development phase. Do not hesitate to contribute.

[![Build Status](https://camo.githubusercontent.com/569dad6aae1871daa9e536f067e7454e09b6416ca3327ae08291e6a23028515e/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f6b77617474726f2f4b77617474726f4d61726b646f776e42756e646c652e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/kwattro/KwattroMarkdownBundle)

#### Todo's:

[](#todos)

- Merge the parameters with the DI config
- Add all possible extensions to DI config
- Add flags feature
- Convert config files to .xml
- Make the Twig extension use of Markdown class
- Add some tests
- Structured docs
- Request feedbacks

Open Source Community
---------------------

[](#open-source-community)

This bundle wraps the work of amazing developers:

`Sundown` is based on the original Upskirt parser by Natacha Porté, with many additions by Vicent Marti (@tanoku) and contributions from the following authors:

```
Ben Noordhuis, Bruno Michel, Joseph Koshy, Krzysztof Kowalczyk, Samuel Bronson,
Shuhei Tanuma

```

`php-sundown` is a php wrapper of the `Sundown` project made by \[chobie\] ()

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

[](#installation)

### Install sundown and php-sundown on your server

[](#install-sundown-and-php-sundown-on-your-server)

```
git clone https://github.com/chobie/php-sundown.git php-sundown -b development
cd php-sundown
# this command will fetch submodule and copy neccesary files to src dir and compile it.
rake submodule compile
sudo rake install

# enable the sundown extension by adding the following line to your php.ini
extension=sundown.so

```

### Download the KwattroMarkdownBundle

[](#download-the-kwattromarkdownbundle)

Add the following to your deps file:

```
[KwattroMarkdownBundle]
    git=http://github.com/kwattro/KwattroMarkdownBundle.git
    target=/bundles/Kwattro/MarkdownBundle

```

And run the following command:

```
php bin/vendors install

```

### Register the bundle

[](#register-the-bundle)

Add the `Kwattro` namespace to the autoloader:

```
# /app/autoload.php
$loader->registerNamespaces(array(
//...
'Kwattro' => __DIR__.'/../vendor/bundles',
));

```

And finally, register the bundle in your AppKernel

```
# /app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
    //...
    new Kwattro\MarkdownBundle\KwattroMarkdownBundle(),
    );
}

```

How to use it
-------------

[](#how-to-use-it)

#### In your twig templates

[](#in-your-twig-templates)

You can easily use the markdown parser in your Twig templates:

```
{{ body | markdown }}

```

#### In your controllers by using the `kwattro_markdown` service name:

[](#in-your-controllers-by-using-the-kwattro_markdown-service-name)

```
$markdown = $this->container->get('kwattro_markdown');
$string = $body; //Some string to transform
$output = $markdown->render($string);

```

#### You can custom the extensions and the render to use on the fly. The second array parameter is for the flags.

[](#you-can-custom-the-extensions-and-the-render-to-use-on-the-fly-the-second-array-parameter-is-for-the-flags)

##### In your controllers :

[](#in-your-controllers-)

```
$md = $this->container->get('kwattro_markdown');
$string = $body; // some string to transform
$output = $md->render($string, array('autolink' => false), array(), 'xhtml')

```

##### In your templates

[](#in-your-templates)

```
{{ body | markdown( {'autolink': false}, {}, 'html') }}

```

Syntax
------

[](#syntax)

For more information about the `Markdown syntax`, visit the markdown author \[website\] ()

Configuration Reference
-----------------------

[](#configuration-reference)

You can configure the bundle simply in the config.yml file:

```
kwattro_markdown:
    twig_extension: ~ // default is the twig extension provided by the bundle
    renderer : ~ // default `html` You can choose between html | xhtml | base | custom
    render_class: ~ based off the renderer chosen, you have to specify one if "custom" is chosen
    extensions:
        no_intra_emphasis: false
        tables: true
        fenced_code_blocks: true
        autolink: true
        strikethrough: true
        lax_html_blocks: false
        space_after_headers: true
        superscript: false
    flags:
        filter_html: false
        no_images: false
        no_links: false
        no_styles: false
        safe_links_only: false
        with_toc_data: false
        hard_wrap: true
        xhtml: true

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 99.1% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/c66009f0f147bb7dfcfbbd6837176b2fe6c6e2cdcf82d9ad07ab7d7aa47735f4?d=identicon)[ikwattro](/maintainers/ikwattro)

---

Top Contributors

[![ikwattro](https://avatars.githubusercontent.com/u/1222009?v=4)](https://github.com/ikwattro "ikwattro (109 commits)")[![dominics](https://avatars.githubusercontent.com/u/97427?v=4)](https://github.com/dominics "dominics (1 commits)")

### Embed Badge

![Health badge](/badges/kwattro-markdown-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/kwattro-markdown-bundle/health.svg)](https://phpackages.com/packages/kwattro-markdown-bundle)
```

###  Alternatives

[mtdowling/jmespath.php

Declaratively specify how to extract elements from a JSON document

2.0k472.8M135](/packages/mtdowling-jmespathphp)[opis/closure

A library that can be used to serialize closures (anonymous functions) and arbitrary data.

2.6k230.0M284](/packages/opis-closure)[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)[michelf/php-markdown

PHP Markdown

3.5k52.4M345](/packages/michelf-php-markdown)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)

PHPackages © 2026

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