/markdown-diff

[READ-ONLY] Package to print diffs for Markdown

Primary LanguagePHPMIT LicenseMIT

Markdown Diff

Downloads total

Install

composer require symplify/markdown-diff

Add to config/config.php:

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\MarkdownDiff\ValueObject\MarkdownDiffConfig;

return static function (ContainerConfigurator $containerConfigurator): void {
    $containerConfigurator->import(MarkdownDiffConfig::class);
};

Usage

namespace App;

use Symplify\MarkdownDiff\Differ\MarkdownDiffer;

final class SomeClass
{
    /**
     * @var MarkdownDiffer
     */
    private $markdownDiffer;

    public function __construct(MarkdownDiffer $markdownDiffer)
    {
        $this->markdownDiffer = $markdownDiffer;
    }

    public function run(): void
    {
        $markdownDiff = $this->markdownDiffer->diff('oldContent', 'newContent');
        // ...
    }
}

Report Issues

In case you are experiencing a bug or want to request a new feature head over to the Symplify monorepo issue tracker

Contribute

The sources of this package are contained in the Symplify monorepo. We welcome contributions for this package on symplify/symplify.