Render support ticket markdown and ASCII tables as HTML in admin#375
Merged
Conversation
Filament's TextEntry markdown rendering was collapsing single newlines, which mangled pasted artisan output (ASCII tables) into a single line on the admin support ticket view. Replace the bare `->markdown()` with a custom renderer that: - Detects consecutive `+`/`|` lines and converts them into real HTML tables (with a header when separator-delimited, otherwise tbody-only so key/value layouts stay aligned) - Enables soft-break -> `<br />` conversion so other line breaks survive - Applies inline styles (width: auto, padding, borders, zebra stripes, paragraph spacing) using semi-transparent neutrals so the result works in both light and dark Filament themes without depending on Tailwind Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Filament's support ticket Context panel was rendering the message via a bare
->markdown()call, which collapsed single newlines and produced an unreadable run-on paragraph whenever a user pasted artisan output (ASCII tables) into the Environment field of a bug report.This PR replaces the
->markdown()call on the message TextEntry with a customrenderTicketMessage()helper that:+/|lines and converts them into real HTML<table>elements. If the first row is separator-delimited it becomes a<thead>; otherwise the table is tbody-only so key/value style artisan output stays aligned.soft_break => "<br />"so single newlines in the original message survive.width: auto, padding, borders, zebra striping, paragraph spacing) using semi-transparent neutral colors. This keeps the layout compact (tables don't span the full panel), readable (key sits next to value), and works in both light and dark Filament themes without relying on Tailwind classes (which aren't guaranteed available in this Filament context).Test plan
php artisan test --compact tests/Feature/SupportTicketTest.php(87 passed)/admin/support-tickets/{ticket}for a ticket whose message contains pasted artisan output and confirm: bold labels render, sections have visible spacing, ASCII tables render as proper HTML tables sized to content with zebra stripes.🤖 Generated with Claude Code