use Blockshift\ChatMarkdown\MarkdownConverter;
$message = MarkdownConverter::toSlack($markdown);
// Send $message through your preferred Laravel notification, queue job,
// bot SDK, webhook client, or chat integration.
use Blockshift\ChatMarkdown\MarkdownConverter;
use Blockshift\ChatMarkdown\Renderers\TelegramRenderer;
$result = MarkdownConverter::parse($markdown)
->withOptions([
'table_mode' => 'bullets',
'parse_tables' => true,
])
->using(new TelegramRenderer)
->render();
use Blockshift\ChatMarkdown\MarkdownConverter;
$longText = str_repeat('This is a long message. ', 500);
$chunks = MarkdownConverter::toTelegram($longText, maxLength: 4096);
// Returns array of chunks, each under 4096 characters
use Blockshift\ChatMarkdown\MarkdownConverter;
use Blockshift\ChatMarkdown\Renderers\AbstractRenderer;
use Blockshift\ChatMarkdown\Support\IntermediateRepresentation;
class CustomRenderer extends AbstractRenderer
{
protected function renderBlock(array $block): string
{
return match ($block['type']) {
'paragraph' => 'PARA: '.$block['content'],
'code' => 'CODE: '.$block['content'],
default => '',
};
}
}
$result = MarkdownConverter::parse($markdown)
->using(new CustomRenderer)
->render();