0.1.2 2021-01-31 06:55 UTC

This package is auto-updated.

Last update: 2022-01-06 01:03:17 UTC


Abstraction layer for using several Markdown converters, mostly written in PHP.


Use Cases

Allows to convert Markdown to other formats (HTML only at the moment). Within this library this process will done using a Renderer, since a Markdown code will be rendered into another format. Since there are several Markdown flavors and implementations, this library is providing an abstraction layer to easily switch between flavors.

Allows to convert other formats (HTML only at the moment) to Markdown. Within this library this process will done using a Parser, since other formats will be parsed to be understood as Markdown.


This library aims to provide an abstraction layer for existing implementations for convert Markdown into and from other formats. This will be done by maintaining a list of Open Source packages and providing this collection easily using composer.


Using composer:

composer require ceus-media/markdown


After loading the libraries or using autoloading, e.G. using composer, you can use this library the following ways.


To render Markdown code into HTML, using the PHP implementation of Commonmark syntax:

use \CeusMedia\Markdown\Renderer\Html;

$renderer	= new Html();
//$renderer->setRenderer( Html::RENDERER_PARSEDOWN );
$html		= $renderer->convert( "## Heading 2" );

You can change the used renderer, for example to support tables and fenced code by switching to Parsedown:

$renderer->setRenderer( Html::RENDERER_PARSEDOWN );


Trying to convert HTML to Markdown can be done like this:

use \CeusMedia\Markdown\Parser\Html;

$parser		= new Html();
$markdown	= $parser->convert( "<h2>Heading</h2>" );


The next versions will include other output formats (like PDF or Open Document) and input formats (like DokuWiki and other Wiki syntaxes).


Add DokuWiki Parser