PHPackages                             taufik-nurrohman/markdown - 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. taufik-nurrohman/markdown

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

taufik-nurrohman/markdown
=========================

Obviously, a Markdown parser.

121.7k↑46.7%2PHP

Since Sep 7Pushed 5d ago2 watchersCompare

[ Source](https://github.com/taufik-nurrohman/markdown)[ Packagist](https://packagist.org/packages/taufik-nurrohman/markdown)[ RSS](/packages/taufik-nurrohman-markdown/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependenciesVersions (2)Used By (0)

PHP Markdown Parser
===================

[](#php-markdown-parser)

[![from.php](https://camo.githubusercontent.com/6afb67efb467435cb598911ff9e2807c5bfd1e519067aa874510b67d2de4e3f3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73697a652f74617566696b2d6e7572726f686d616e2f6d61726b646f776e2f66726f6d2e7068703f6272616e63683d6d61696e26636f6c6f723d253233346635643935266c6162656c3d66726f6d2e706870266c6162656c436f6c6f723d253233316632333238267374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/6afb67efb467435cb598911ff9e2807c5bfd1e519067aa874510b67d2de4e3f3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73697a652f74617566696b2d6e7572726f686d616e2f6d61726b646f776e2f66726f6d2e7068703f6272616e63683d6d61696e26636f6c6f723d253233346635643935266c6162656c3d66726f6d2e706870266c6162656c436f6c6f723d253233316632333238267374796c653d666c61742d737175617265) [![to.php](https://camo.githubusercontent.com/600097103ff88d97bc9f2b34da20f6e6ca2e2db8ab232cb15ead3bbad11a8399/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73697a652f74617566696b2d6e7572726f686d616e2f6d61726b646f776e2f746f2e7068703f6272616e63683d6d61696e26636f6c6f723d253233346635643935266c6162656c3d746f2e706870266c6162656c436f6c6f723d253233316632333238267374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/600097103ff88d97bc9f2b34da20f6e6ca2e2db8ab232cb15ead3bbad11a8399/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73697a652f74617566696b2d6e7572726f686d616e2f6d61726b646f776e2f746f2e7068703f6272616e63683d6d61696e26636f6c6f723d253233346635643935266c6162656c3d746f2e706870266c6162656c436f6c6f723d253233316632333238267374796c653d666c61742d737175617265)

With 90% compliance to [CommonMark 0.31.2](https://spec.commonmark.org/0.31.2) specifications.

Motivation
----------

[](#motivation)

   ![Why?](https://github.com/taufik-nurrohman/markdown/assets/1669261/164b592d-e8db-4e28-be5d-467522f65f0d)I appreciate the [Parsedown](https://github.com/erusev/parsedown) project for its simplicity and speed. It uses only a single class file to convert Markdown syntax to HTML. However, given the decrease in Parsedown project activity over time, I assume that it is now in the state of “feature complete”. It still has some bugs to fix, and with [the recent release of PHP version 8.1](https://www.php.net/releases/8.1/en.php), some of the PHP syntax there has become obsolete.

There is actually [a draft for Parsedown version 2.0](https://github.com/erusev/parsedown/tree/2.0.x), but it is no longer made as a single class file. It’s broken down into components. The goal, I think, is to make it easy to add functionality without breaking what’s already in the core. For others, it may be of great use, but I see it as a form of similarity to the features provided by [CommonMark](https://github.com/thephpleague/commonmark/blob/2.4/docs/2.4/customization/extensions.md). Because of that, if I want to upgrade, it might be more optimal to just switch to CommonMark.

I’m not into things like that. As someone who needs a function to convert Markdown syntax to HTML, that kind of flexibility is completely unnecessary to me. I just want to convert Markdown syntax to HTML for once and then move on. It was fulfilled by [Parsedown version 1.8](https://github.com/erusev/parsedown/tree/1.8.x-beta), but it seems that it is no longer being actively maintained.

The goal of this project is to use it in my [Markdown extension for Mecha](https://github.com/mecha-cms/x.markdown) in the future. Previously, I wanted to develop this converter directly into the extension, but my friend advised me to create this project separately as it might have potential to be used by other developers beyond the [Mecha CMS](https://github.com/mecha-cms) developers.

Usage
-----

[](#usage)

This converter can be installed using [Composer](https://packagist.org/packages/taufik-nurrohman/markdown), but it doesn’t need any other dependencies and just uses Composer’s ability to automatically include files. Those of you who don’t use Composer should be able to include the `from.php` and `to.php` files directly into your application without any problems.

### Using Composer

[](#using-composer)

From the command line interface, navigate to your project folder then run this command:

```
composer require taufik-nurrohman/markdown
```

Require the generated auto-loader file in your application:

```
