yansongda/laravel-parsehtml

Convert Html To Markdown With Laravel

v1.1.0 2018-03-28 08:37 UTC

README

Scrutinizer Code Quality Build Status Latest Stable Version Total Downloads Latest Unstable Version License

This Package depends on league/html-to-markdown

Installation

$ composer require yansongda/laravel-parsehtml

Add service provider

<?php

Yansongda\LaravelParsehtml\ParsehtmlServiceProvider::class,

Add alias

<?php

'LaravelParsehtml' => Yansongda\LaravelParsehtml\Facades\Parsehtml::class,

Config(OPTION)

$ php artisan vendor:publish --provider="Yansongda\\LaravelParsehtml\\ParsehtmlServiceProvider" --tag=laravel-html-config
config desc
strip_tags strip HTML tags that don't have a Markdown equivalent
remove_nodes strip tags and their content
italic_style
bold_style
hard_break
header_style atx/etx

Reference: league/html-to-markdown

Usage

Using blade

<?php

@parsehtml('<h2>blablabla</h2>');

Using Helper

<?php

{{ parsehtml('<h2>blablabla</h2>') }}

License

MIT