1. Go to this page and download the library: Download catouse/turndown-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
catouse / turndown-php example snippets
use Catouse\Turndown\TurndownService;
$service = new TurndownService([
'headingStyle' => 'atx',
]);
$markdown = $service->turndown('<h1>Hello world!</h1>');
// # Hello world!
$document = new DOMDocument();
$document->loadHTML('<div><p>Hello <strong>world</strong>.</p></div>');
$markdown = $service->turndown($document);
function (string $content, DOMElement $node, array $options): string