PHPackages                             nessworthy/parsedown-extension-manager - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. nessworthy/parsedown-extension-manager

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

nessworthy/parsedown-extension-manager
======================================

Extend Parsedown in a more SOLID way.

1.0.5(5y ago)029WTFPLPHPPHP &gt;=7.1CI failing

Since Nov 17Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Nessworthy/parsedown-extension-manager)[ Packagist](https://packagist.org/packages/nessworthy/parsedown-extension-manager)[ RSS](/packages/nessworthy-parsedown-extension-manager/feed)WikiDiscussions master Synced yesterday

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

Parsedown Extensions
====================

[](#parsedown-extensions)

A tiny project which introduces a new way to create and use markdown extensions with [erusev/parsedown](https://github.com/erusev/parsedown/)!

Requirements
------------

[](#requirements)

- PHP 7.1

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

[](#installation)

It's a composer installation away!

```
composer require nessworthy/parsedown-extension-manager

```

Why?
----

[](#why)

Each extension added to Parsedown must be done by extending it, registering the extension in a few places, and adding 1-3 new methods in the extended class.

After adding in a few extensions the original way, I grew a little frustrated at how "vertical" the markdown class was becoming.

So, I decided to change the way extensions could be registered.

What's new?
-----------

[](#whats-new)

Extensions can be represented as concrete classes of one of two interfaces: `ParsedownBlockExtension`, or `ParsedownInlineExtension`.

Each extension is then separately instantiated and registered to your `Nessworthy\ParsedownExtensionManager\Parsedown` instance by using the added `registerBlockExtension` or `registerInlineExtension` and passing your extension through.

Parsedown will use your extensions in the same way as it normally would with the benefit of each extension being isolated and separately extendable!

Usage Example
-------------

[](#usage-example)

### Step 1: Create your Extension!

[](#step-1-create-your-extension)

Extensions can either implement [`\Nessworthy\ParsedownExtensionManager\ParsedownInlineExtension`](https://github.com/Nessworthy/parsedown-extension/blob/master/src/ParsedownInlineExtension.php) or [`\Nessworthy\ParsedownExtensionManager\ParsedownBlockExtension`](https://github.com/Nessworthy/parsedown-extension/blob/master/src/ParsedownBlockExtension.php). Both expect methods which mirror closely to how you would add extensions normally.

```
