PHPackages                             twig/markdown-extension - 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. [Templating &amp; Views](/categories/templating)
4. /
5. twig/markdown-extension

Abandoned → [twig/markdown-extra](/?search=twig%2Fmarkdown-extra)ArchivedLibrary[Templating &amp; Views](/categories/templating)

twig/markdown-extension
=======================

A Twig extension for Markdown

v1.0.7(7y ago)10697.9k7MITPHPPHP ^7.0

Since Feb 25Pushed 6y ago5 watchersCompare

[ Source](https://github.com/twigphp/markdown-extension)[ Packagist](https://packagist.org/packages/twig/markdown-extension)[ Docs](https://twig.symfony.com)[ RSS](/packages/twig-markdown-extension/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (6)Versions (9)Used By (0)

Twig Markdown Extension
=======================

[](#twig-markdown-extension)

**WARNINIG**: This package is deprecate; migrate to `twig/markdown-extra` instead.

This package provides a Markdown to HTML filter (`markdown`) and an HTML to Markdown filter (`html_to_markdown`) for Twig and a Symfony bundle.

If you are not using Symfony, register the extension on Twig's `Environment`manually:

```
use Twig\Markdown\MarkdownExtension;
use Twig\Environment;

$twig = new Environment(...);
$twig->addExtension(new MarkdownExtension());
```

You must also register the extension runtime (skip this step if you are using Symfony or a framework with a Twig integration):

```
use Twig\Markdown\DefaultMarkdown;
use Twig\Markdown\MarkdownRuntime;
use Twig\RuntimeLoader\RuntimeLoaderInterface;

$twig->addRuntimeLoader(new class implements RuntimeLoaderInterface {
    public function load($class) {
        if (MarkdownRuntime::class === $class) {
            return new MarkdownRuntime(new DefaultMarkdown());
        }
    }
});
```

Use the `markdown` and `html_to_markdown` filters from a Twig template:

```
{% filter markdown %}
Title
======

Hello!
{% endfilter %}

{% filter html_to_markdown %}

        Hello!

{% endfilter %}
```

Note that you can indent the Markdown content as leading whitespaces will be removed consistently before conversion:

```
{% filter markdown %}
    Title
    ======

    Hello!
{% endfilter %}
```

You can also add some options by passing them as an argument to the filter:

```
{% filter html_to_markdown({hard_break: false}) %}

        Hello!

{% endfilter %}
```

You can also use the filters on an included file:

```
{{ include('some_template.html.twig')|html_to_markdown }}

{{ include('some_template.markdown.twig')|markdown }}
```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 77.8% 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 ~0 days

Total

8

Last Release

2639d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/47313?v=4)[Fabien Potencier](/maintainers/fabpot)[@fabpot](https://github.com/fabpot)

---

Top Contributors

[![fabpot](https://avatars.githubusercontent.com/u/47313?v=4)](https://github.com/fabpot "fabpot (14 commits)")[![colinodell](https://avatars.githubusercontent.com/u/202034?v=4)](https://github.com/colinodell "colinodell (2 commits)")[![harikt](https://avatars.githubusercontent.com/u/120454?v=4)](https://github.com/harikt "harikt (1 commits)")[![JeremieSamson](https://avatars.githubusercontent.com/u/5656168?v=4)](https://github.com/JeremieSamson "JeremieSamson (1 commits)")

---

Tags

markdownphptwigtwig-extensiontwightmlmarkdown

### Embed Badge

![Health badge](/badges/twig-markdown-extension/health.svg)

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

###  Alternatives

[twig/markdown-extra

A Twig extension for Markdown

12114.3M83](/packages/twig-markdown-extra)[twig/string-extra

A Twig extension for Symfony String

21946.0M133](/packages/twig-string-extra)[picocms/pico

Pico is a flat file CMS, this means there is no administration backend and database to deal with. You simply create .md files in the "content" folder and that becomes a page.

3.9k37.8k11](/packages/picocms-pico)[twig/html-extra

A Twig extension for HTML

777.6M41](/packages/twig-html-extra)[spress/spress

Static site generator with blogs support

37436.2k](/packages/spress-spress)[twig/cache-extra

A Twig extension for Symfony Cache

392.1M20](/packages/twig-cache-extra)

PHPackages © 2026

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