PHPackages                             taufik-nurrohman/markdown-filter - 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. [Search &amp; Filtering](/categories/search)
4. /
5. taufik-nurrohman/markdown-filter

ActiveLibrary[Search &amp; Filtering](/categories/search)

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

Safely replace text in a Markdown document.

v1.0.4(2y ago)15MITPHPPHP &gt;=7.1

Since Apr 8Pushed 2y ago1 watchersCompare

[ Source](https://github.com/taufik-nurrohman/markdown-filter)[ Packagist](https://packagist.org/packages/taufik-nurrohman/markdown-filter)[ Docs](https://github.com/taufik-nurrohman/markdown-filter)[ Fund](https://paypal.me/tatautaufik)[ RSS](/packages/taufik-nurrohman-markdown-filter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)DependenciesVersions (6)Used By (0)

PHP Markdown Filter
===================

[](#php-markdown-filter)

[![index.php](https://camo.githubusercontent.com/121d83eb61d0f8b4bf9e9c64feeb80b6670b2d45b0152699e300b1a42134717a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73697a652f74617566696b2d6e7572726f686d616e2f6d61726b646f776e2d66696c7465722f696e6465782e7068703f6272616e63683d6d61696e26636f6c6f723d253233346635643935266c6162656c3d696e6465782e706870266c6162656c436f6c6f723d253233316632333238267374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/121d83eb61d0f8b4bf9e9c64feeb80b6670b2d45b0152699e300b1a42134717a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73697a652f74617566696b2d6e7572726f686d616e2f6d61726b646f776e2d66696c7465722f696e6465782e7068703f6272616e63683d6d61696e26636f6c6f723d253233346635643935266c6162656c3d696e6465782e706870266c6162656c436f6c6f723d253233316632333238267374796c653d666c61742d737175617265)

Motivation
----------

[](#motivation)

As [Markdown](https://github.com/taufik-nurrohman/markdown) has grown in popularity, many people have expected to see new formatting syntaxes added. However, people who develop Markdown parsers will generally stick to the philosophy that [John Gruber](https://daringfireball.net/projects/markdown) has explained, that the design goal of Markdown’s formatting syntax is to make it as readable as possible. The idea is that a Markdown-formatted document should be publishable as-is, as plain text, without looking like it’s been marked up with tags or formatting instructions.

Typically, they will simply tell people to use raw HTML syntax if their wishes are too complex and/or not in line with Markdown’s philosophy. Markdown parser generally does not prohibit people from doing so.

People who just know how to search and replace text with PHP often give naive suggestions, such as telling people to use regular expressions to replace text directly in the Markdown document, which often ends up with people replacing text in the wrong places, such as replacing text inside a code block syntax that should be left as it is.

This filter can be used to separate parts of a Markdown document into blocks and spans, so that you can replace text only in certain blocks and spans that you consider safe.

Usage
-----

[](#usage)

This converter can be installed using [Composer](https://packagist.org/packages/taufik-nurrohman/markdown-filter), 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 `index.php` file 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-filter
```

Require the generated auto-loader file in your application:

```
