use Soleinjast\SymfonyMarkdownResponseBundle\Attribute\ProvideMarkdownResponse;
#[ProvideMarkdownResponse]
class DocsController extends AbstractController
{
public function index(): Response { /* ... */ }
public function show(): Response { /* ... */ }
}
#[ProvideMarkdownResponse]
class BlogController extends AbstractController
{
public function index(): Response { /* ... */ }
#[ProvideMarkdownResponse(enabled: false)]
public function edit(): Response { /* only humans edit posts */ }
}
use Soleinjast\SymfonyMarkdownResponseBundle\Converter\HtmlPreprocessorInterface;
class RemoveCookieBannerPreprocessor implements HtmlPreprocessorInterface
{
public function process(string $html): string
{
// Remove cookie consent banners, ads, or any other noise
return preg_replace('/<div[^>]+class="[^"]*cookie[^"]*".*?<\/div>/si', '', $html);
}
}
use Soleinjast\SymfonyMarkdownResponseBundle\Converter\MarkdownConverter;
class SitemapExporter
{
public function __construct(private readonly MarkdownConverter $converter) {}
public function export(string $html): string
{
return $this->converter->convert($html);
}
}
GET /docs/getting-started HTTP/1.1
Accept: text/markdown
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.